4
Follow
11
Followers
'''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].SetDirection("buy")
# exchanges[r].Buy(-1, 10, "开多")
# position_cangwei = _C(exchange.GetPosition)
# Log(position_cangwei)
# Sleep(10000)
留下策略最后5行,报错:品种订阅失败 BTC_USDT_Futures_Binance
注释掉策略最后第2-5行,留下一个Sleep(10000),还是报错:品种订阅失败 BTC_USDT_Futures_Binance
只有把策略最后5行全注释掉,策略才不报错,但回测停不下来了。
求教:多交易对策略怎么做

Related Recommendations
Inventor Quant Workflow FAQ (Continuously Updated)Financial Magic Zone Global KOL RecruitmentFAQ Summary (Updating...)PINE Language Introductory Tutorial of FMZ QuantPrimary Tutorial of Strategy Writing with FMZ Quant Trading Platform (Must Read)Getting Started with FMZ Quant Trading Platform (Must Read)MyLanguage DocFMZ PINE Script DocNotes & Explanation of Futures Reverse Doubling Algorithm StrategySolutions to Obtaining Docker Http Request Message
Comment
All comments (1)
'''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)
期货要设置合约的。
4 years ago
- 1
