'''backtest
start: 2022-11-18 00:00:00
end: 2022-11-18 00:01:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"},{"eid":"Futures_Binance","currency":"ETH_USDT"},{"eid":"Futures_Binance","currency":"ETC_USDT"}]
'''
def main():
while True:
Log(exchange.GetAccount())
for r in range(len(exchanges)):
Log ((("ditambahkan indeks objek pertukaran (((yang pertama adalah 0 dengan asumsi ini):", r, "nama:", exchanges[r].GetName(), "Tag:", exchanges[r].GetLabel())
exchanges[r].SetDirection("buy")
exchanges[r].Buy ((-1, 10, "Keido")
position_cangwei = _C(exchange.GetPosition)
Log(position_cangwei)
Sleep(10000)
Tinggalkan 5 baris terakhir dari strategi, kesalahan: Varietas langganan gagal BTC_USDT_Futures_Binance
Berkomentar pada baris 2-5 terakhir dari strategi, tinggalkan satu Sleep ((10000), atau lewatkan: Varietas langganan gagal BTC_USDT_Futures_Binance
Hanya dengan menghapus 5 baris terakhir dari komentar, strategi tidak akan gagal, tetapi pengulangan terus berlanjut.
Pelajaran: Cara Mengatasi Strategi Multi-Transaction

'''backtest
start: 2022-11-18 00:00:00
end: 2022-11-18 00:01:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"},{"eid":"Futures_Binance","currency":"ETH_USDT"},{"eid":"Futures_Binance","currency":"ETC_USDT"}]
'''
def main():
while True:
Log(exchange.GetAccount())
for r in range(len(exchanges)):
Log("添加的交易所对象索引(第一个为0以此类推):", r, "名称:", exchanges[r].GetName(), "标签:", exchanges[r].GetLabel())
exchanges[r].SetContractType("swap") # 期货要设置合约的
exchanges[r].SetDirection("buy")
exchanges[r].Buy(-1, 10, "开多")
position_cangwei = _C(exchange.GetPosition)
Log(position_cangwei)
Sleep(10000)
期货要设置合约的。
- 1
