You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
813 B
35 lines
813 B
# -*- coding: utf-8 -*-
|
|
|
|
import time
|
|
import logging
|
|
from binance.binance_trader import BinanceTrader
|
|
from binance.binance_future_trader import BinanceFutureTrader
|
|
from utils import utility
|
|
from utils import config
|
|
format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
logging.basicConfig(level=logging.INFO, format=format, filename='grid_trader_log.txt')
|
|
logger = logging.getLogger('binance')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
config.loads('./conf/config.json')
|
|
|
|
if config.platform == 'binance_spot':
|
|
trader = BinanceTrader()
|
|
else:
|
|
trader = BinanceFutureTrader()
|
|
|
|
|
|
|
|
while True:
|
|
try:
|
|
trader.get_depth(5)
|
|
time.sleep(20)
|
|
|
|
except Exception as error:
|
|
utility.alert(f"交易{config.symbol}: {error}")
|
|
time.sleep(5)
|
|
|