Reading all current user orders (market, limit, stop limit, and market stop)

Custom indicators, trading strategies, data export and recording and more...
scotteza
Posts: 8
Joined: Sun Sep 06, 2020 8:08 pm
Has thanked: 2 times

Reading all current user orders (market, limit, stop limit, and market stop)

Post by scotteza » Sun Sep 20, 2020 7:27 pm

Hi there

I've been looking through the example code from the Bookmap GitHub account, as well as through all of the topics on the forum, and the JavaDoc for the Layer 1 API.

I can't find any info on fetching order details for the logged-in Bookmap user. What I would like to be able to read is the following:
- Current limit orders the user has on the order book.
- Current open positions the user has (i.e. market orders they placed, and limit orders they had in the book which were subsequently filled and became market orders)
- Current market-stops for the user's open position(s)
- Current limit-stops for the user's open position(s)

I'd like to be able to use this information to write some automation on my own strategies.

From what I've seen in the example code, it looks like I would have to write something to track current orders myself by overriding the methods in the OrdersListener interface, as shown in the CancelOrdersCloseToMarket example. Is this correct?

Thanks,
Scott Edwards

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Reading all current user orders (market, limit, stop limit, and market stop)

Post by Andry API support » Mon Sep 21, 2020 8:21 am

Hi Scott,
1, 3, 4) when your module gets loaded all your (market/limit/...) current (and sometimes recently filled/canceled) orders are passed to your onOrderUpdated method. Filter out whatever order type you need.
2) your position is passed to the onPositionUpdate method if your module implements the PositionListener interface.

These methods belong to listeners of the Simplified API which is very easy to use.
SImplified API examples:
https://github.com/BookmapAPI/DemoStrat ... ified/demo
You can get the javadoc from:

Code: Select all

C:\Program Files\Bookmap\lib\bm-simplified-api-wrapper-javadoc.jar
This location is for Windows. Use a similar location for any other OS. Rename from .jar to .zip and open the index.html.

scotteza
Posts: 8
Joined: Sun Sep 06, 2020 8:08 pm
Has thanked: 2 times

Re: Reading all current user orders (market, limit, stop limit, and market stop)

Post by scotteza » Mon Sep 21, 2020 5:47 pm

Great, thank you very much!

zcsoka
Posts: 290
Joined: Thu Dec 19, 2019 7:50 pm
Has thanked: 2 times
Been thanked: 28 times

Re: Reading all current user orders (market, limit, stop limit, and market stop)

Post by zcsoka » Fri Oct 16, 2020 9:07 am

In Replay mode the onPositionUpdate and onBalance seems not to be called even if there is no historical listener. I have :
implements CustomModule, TradeDataListener, CustomSettingsPanelProvider, IntervalListener, OrdersListener, PositionListener, BalanceListener

Is it normal? Is there a trick to call them? Right now I manage my current positions updating a variable, but a regular consolidation between calculated and actual positions would be beneficial.

Svyatoslav
Site Admin
Posts: 278
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Reading all current user orders (market, limit, stop limit, and market stop)

Post by Svyatoslav » Fri Oct 16, 2020 7:52 pm

Unfortunately bookmap simulated trading (which is what you have in replay) does not currently implement balance and position updates. That's something we need to eventually implement.

Post Reply