示例#1
0
## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())

# Ticker
# print(gate_query.ticker('eos_usdt'))

# Tickers
# print(gate_query.tickers())

# OrderBook
print(gate_query.orderBook('eos_usdt'))

# Depth
# print(gate_query.orderBooks())

# orders
# print(gate_query.openOrders())

# Candle
# print(gate_query.candle('eos_usdt', 5, 0.1))

## Below, use methods that make use of the users keys

# Ticker
# print(gate_query.ticker('btc_usdt'))
示例#2
0
print(gate_query.orderBooks())

# orders
print("获取我的当前挂单列表API")
print(gate_query.openOrders())

# 下面的都是需要个人用户的秘钥的api,基本都是操作个人用户的api
## Below, use methods that make use of the users keys

# Ticker
print("具体交易的行情")
print(gate_query.ticker('btc_usdt'))

# Market depth of pair
print("交易对的市场深度")
print(gate_query.orderBook('btc_usdt'))

# Trade History
print("返回最新80条历史成交记录")
print(gate_query.tradeHistory('btc_usdt'))

# Get account fund balances
print("获取帐号资金余额API")
print(gate_trade.balances())

# get new address
print(gate_trade.depositAddres('btc'))

# get deposit withdrawal history
print(gate_trade.depositsWithdrawals('1469092370', '1569092370'))
示例#3
0
    #//$amount = $orders[$num]['amount'];
    #$pair = $orders[$num]['currencyPair'];
    #$ID = $orders[$num]['orderNumber'];
    #}

    #print_r("ORDER=>".$ID."\n");
    #print_r(cancel_order($ID));
    #} while (1 < $q--);
    #for ($x=0; $x<$q; $x++)
    #   {
    #   $order_id = $PIDs[$x];
    #   $pair = $return[$order_id]['pair'];
    #  $type = $return[$order_id]['type'];
    #  }

    depth_btc = gate.orderBook('btc_usdt')
    d_b_btc_usd = depth_btc['bids'][0][0]
    d_s_btc_usd = depth_btc['asks'][-1][0]
    v_btc_usd = round((d_b_btc_usd * 0.025),
                      2)  #ШАГ В СТАКАНЕ 2,5% ОТ ЦЕНЫ ПОКУПКИ
    print('макс. цена покупки BTC_USDT', d_b_btc_usd)
    print('мини. цена продажи BTC_USDT', d_s_btc_usd)
    f_btc_usd = round((FEE / 100 * d_s_btc_usd * 2 * PROFIT), 2)
    s_btc_usd = round(d_s_btc_usd - d_b_btc_usd, 2)
    proc_btc_usd = round((s_btc_usd / d_b_btc_usd) * 100, 2)
    val_b_btc_usd = round(USD / d_b_btc_usd, 6)
    val_s_btc_usd = round(USD / d_s_btc_usd, 6)

    depth_bifi = gate.orderBook('bifi_usdt')
    d_b_bifi_usd = depth_bifi['bids'][0][0]
    d_s_bifi_usd = depth_bifi['asks'][-1][0]