Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Position order in global account
 Post subject: Position order in global account Post rating: 0   New post Posted: Thu 22 Mar, 2018, 20:17 

User rating: 1
Joined: Mon 16 Jul, 2012, 04:14
Posts: 31
Good evening, support! How to determine the order label (or order) that corresponds to the total position in the global account?
Yours sincerely ASLog.


 
 Post subject: Re: Position order in global account Post rating: 0   New post Posted: Fri 23 Mar, 2018, 17:46 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You can get a list of all your orders and then filter them.

  public void onStart(IContext context) throws JFException {
    engine = context.getEngine();
    console = context.getConsole();

    List<IOrder> orders;
    orders = engine.getOrders();

    for (IOrder order : orders) {
      if (order.getState() == State.FILLED) {
        console.getOut().println(order);
        //for label console.getOut().println(order.getLabel());
      }
    }
  }


 
 Post subject: Re: Position order in global account Post rating: 0   New post Posted: Fri 23 Mar, 2018, 19:01 

User rating: 1
Joined: Mon 16 Jul, 2012, 04:14
Posts: 31
Hello support! This does not work if there are partially filled orders.
ASLog.


 
 Post subject: Re: Position order in global account Post rating: 0   New post Posted: Mon 26 Mar, 2018, 09:25 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
For this case you can implement additional filter. Filled orders and partially filled orders can be separated by comparing order amount with order requested amount.

if (order.getAmount() == order.getRequestedAmount()) {
    console.getOut().println("Filled order: " + order);
} else {
    console.getOut().println("Partially filled order: " + order);
}


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com