Open pr0ndisk opened 5 years ago
PRICE_PRECISION_EXCEEDED
ですので指値( "price":"110.79999999999999"
)の桁数が多すぎるためエラーになっていると思われます。round
等を使用して桁数を調整してみてください。
http://jiji2.unageanu.net/usage/030400_trap_repeat_if_done_agent.html を特に触らずに使っています。 しばらく放置してたら、注文は通るようになりました。
注文は通るのですが、take profitの値が反映されないようです。
なるほど、、、ご報告ありがとうございます。
OANDA API v20への移行の影響で take profit
の指定方法が変わったのでその影響で動作しなくなっているようです。時間を見て修正しておきます。
下記のようなエラーメッセージが表示され、注文が通りません。
E, [2019-03-07T12:02:47.552307 #1] ERROR -- : An error as occured while processing response. Status 400 {"orderRejectTransaction":{"type":"MARKET_IF_TOUCHED_ORDER_REJECT","instrument":"USD_JPY","units":"300","price":"110.79999999999999","timeInForce":"GTC","triggerCondition":"DEFAULT","partialFill":"DEFAULT","positionFill":"DEFAULT","reason":"CLIENT_ORDER","rejectReason":"PRICE_PRECISION_EXCEEDED","id":"6864","accountID":"001-009-1939778-001","userID":1939778,"batchID":"6864","requestID":"78566986778195099","time":"2019-03-07T12:02:47.539716401Z"},"relatedTransactionIDs":["6864"],"lastTransactionID":"6864","errorMessage":"The price specified contains more precision than is allowed for the instrument","errorCode":"PRICE_PRECISION_EXCEEDED"} (OandaApiV20::RequestError) /usr/local/bundle/gems/oanda_api_v20-2.0.0/lib/oanda_api_v20/api.rb:59:in
rescue in method_missing' /usr/local/bundle/gems/oanda_api_v20-2.0.0/lib/oanda_api_v20/api.rb:54:in
method_missing' /app/jiji2/src/jiji/model/securities/internal/oanda/ordering.rb:21:inorder' /app/jiji2/src/jiji/model/trading/brokers/abstract_broker.rb:190:in
order' /app/jiji2/src/jiji/model/trading/brokers/abstract_broker.rb:75:inbuy' /app/jiji2/src/jiji/model/trading/brokers/broker_proxy.rb:33:in
buy' agent/USD.rb:229:inregister_order' agent/USD.rb:122:in
register_order' agent/USD.rb:82:inblock in register_orders' agent/USD.rb:102:in
block in each_traps' agent/USD.rb:99:intimes' agent/USD.rb:99:in
each_traps' agent/USD.rb:80:inregister_orders' agent/USD.rb:29:in
next_tick' /app/jiji2/src/jiji/model/agents/agents.rb:35:inblock in next_tick' /app/jiji2/src/jiji/model/agents/agents.rb:33:in
each' /app/jiji2/src/jiji/model/agents/agents.rb:33:innext_tick' /app/jiji2/src/jiji/model/trading/jobs/notify_next_tick_job.rb:15:in
exec' /app/jiji2/src/jiji/model/trading/process.rb:35:indo_next_job' /app/jiji2/src/jiji/model/trading/process.rb:28:in
run' /app/jiji2/src/jiji/model/trading/process.rb:22:inblock in start' /usr/local/bundle/gems/thread-0.2.2/lib/thread/pool.rb:67:in
execute' /usr/local/bundle/gems/thread-0.2.2/lib/thread/pool.rb:405:inblock (2 levels) in spawn_thread' /usr/local/bundle/gems/thread-0.2.2/lib/thread/pool.rb:372:in
loop' /usr/local/bundle/gems/thread-0.2.2/lib/thread/pool.rb:372:in `block in spawn_thread'