happydasch / btoandav20

Support for Oanda-V20 API in backtrader
Apache License 2.0
131 stars 52 forks source link

get position update #75

Closed happydasch closed 2 years ago

happydasch commented 3 years ago

Hi @andychen-io

i would like to merge your changes into upstream master. could you explain shortly what your changes do.

Cheers

andychen-io commented 3 years ago

Hi happydasch,

First of all, thanks for building and sharing the btoandav20 library, great work!

My changes is actually a "workaround" for the issue i'm encounter during my paper testing with oanda api, the "Order Completed" status is not received intermittently, causing multiple orders are created because the position is equal to 0, although it has been created in oanda server. It is similar to this issue https://community.backtrader.com/topic/3023/what-am-i-doing-wrong-with-btoandav20-and-notify_order.

Since i can't confirmed if it is either Oanda server or script error, i created the "workaround" to get the latest position from Oanda api. I will call the api self.o.get_server_position() to get the latest position before creating any new order.

Cheers Andy

drbothen commented 2 years ago

I to have this issue where the order is created but I never receive an Order is completed and it results in multiple trades being opened