index_min = 1
if (depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0] < min):
    min = depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0]
    index_min = 2

####### sell algo #######
if (depth_ftusdt["data"]["bids"][0] > max):
    max = depth_ftusdt["data"]["bids"][0]
    index_max = 1
if (depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0] > max):
    max = depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0]
    index_max = 2

####### order algo(buy) #######
if (max > min):
    if (index_min == 1):
        fcoin.market_buy("ftusdt", FT_USDT_QTY)

    elif (index_min == 2):
        fcoin.market_buy("fteth", FT_ETH_QTY)

print("直接買う(index:1):price" + str(depth_ftusdt["data"]["asks"][0]))
print("eth経由で買う(index:2):price" +
      str(depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0]))

print("直接売る(index:1):price" + str(depth_ftusdt["data"]["bids"][0]))
print("eth経由で売る(index:2)price:" +
      str(depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0]))

print("buy index" + str(index_min))
print("sell index" + str(index_max))
Esempio n. 2
0
    index_min = 1
if (depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0] < min):
    min = depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0]
    index_min = 2

####### sell algo #######
if (depth_ftusdt["data"]["bids"][0] > max):
    max = depth_ftusdt["data"]["bids"][0]
    index_max = 1
if (depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0] > max):
    max = depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0]
    index_max = 2

####### order algo(buy) #######
if (max > min):
    if (index_min == 1):
        fcoin.market_buy("ftusdt", FT_USDT_QTY)

    elif (index_min == 2):
        fcoin.market_buy("ethusdt", ETH_USDT_QTY)

print("直接買う(index:1):price" + str(depth_ftusdt["data"]["asks"][0]))
print("eth経由で買う(index:2):price" +
      str(depth_fteth["data"]["asks"][0] * depth_ethusdt["data"]["asks"][0]))

print("直接売る(index:1):price" + str(depth_ftusdt["data"]["bids"][0]))
print("eth経由で売る(index:2)price:" +
      str(depth_fteth["data"]["bids"][0] * depth_ethusdt["data"]["bids"][0]))

print("buy index" + str(index_min))
print("sell index" + str(index_max))