【问题标题】:OANDA / TRADING万达 / 贸易
【发布时间】:2021-12-04 21:19:50
【问题描述】:

我正在尝试在 OANDA 上部署我的算法,但我不断收到 tis 错误。

有人可以帮忙吗?

提前非常感谢!

【问题讨论】:

    标签: trading


    【解决方案1】:

    可能身份验证参数不正确。试试这个oanda's v20 wrapper

    import v20
    token = 'YOUR API TOKEN'
    account_id = 'YOUR ACCOUNT ID'
    
    # using oanda's v20 API wrapper
    ctxs=v20.Context(hostname='stream-fxpractice.oanda.com', token=token)
    ctxs.set_header(key='Authorization', value=token)
    
    # send the request to the stream endpoint
    response=ctxs.pricing.stream(account_id, instruments='EUR_USD,GBP_USD')
    
    # process the incoming stream tick by tick
    for typ, data in response.parts():
       if typ == "pricing.ClientPrice":
           msg="{} ({}) {}/{}".format(
              data.instrument, 
              data.time,
              data.bids[0].price,
              data.asks[0].price)
           print(msg)
           break
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-02
      • 2015-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多