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.
34 lines
783 B
34 lines
783 B
# -*- coding: utf-8 -*-
|
|
|
|
import time
|
|
from binance.binance_trader import BinanceTrader
|
|
from binance.binance_future_trader import BinanceFutureTrader
|
|
from utils import config
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
config.loads('./conf/config.json')
|
|
|
|
trader_spot = BinanceTrader()
|
|
trader_future = BinanceFutureTrader()
|
|
|
|
|
|
|
|
|
|
while True:
|
|
try:
|
|
price_spot = trader_spot.get_latest_price()
|
|
price_future = trader_future.get_latest_price()
|
|
print("diff:")
|
|
print(f"price_spot:{price_spot} price_future:{price_future}")
|
|
print(f"spot/future: {price_spot/price_future}")
|
|
time.sleep(5)
|
|
|
|
except Exception as error:
|
|
print(f"交易{config.symbol}: {error}")
|
|
time.sleep(5)
|
|
|