Dukascopy
 
 
Wiki JStore Search Login

history.getOrderHistory returns nothing,WHY?
 Post subject: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Thu 06 Sep, 2018, 10:44 

User rating: 2
Joined: Mon 30 Apr, 2018, 12:38
Posts: 17
Location: ChinaChina
I test the following simple strategy in the JForex platform(JForex Version:3.4.1,JForex API version:2.13.57),but the message return nothing ,that means no history orders(But I have closed many orders in previous week and months).
the wiki URL is:https://www.dukascopy.com/wiki/en/development/strategy-api/historical-data/order-history#Order%20history%20over%20last%20week.
and the code is:
package jforex.orders;

import java.util.List;
import com.dukascopy.api.*;

public class OrderHistoryLastWeek implements IStrategy {

    private IConsole console;

    @Override
    public void onStart(IContext context) throws JFException {
        console = context.getConsole();

        long time = System.currentTimeMillis();
        List<IOrder> orders = context.getHistory().getOrdersHistory(Instrument.EURUSD, time - Period.WEEKLY.getInterval(), time);
        if (orders != null) {
            for (IOrder order : orders) {
                console.getOut().println("history order: " + order );           
                }
        }
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onStop() throws JFException {}

}

HELP PLEASE!!!


 
 Post subject: Re: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Fri 07 Sep, 2018, 15:07 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Checked, strategy sample works properly. Please recheck. If you sure that in previous week you made a orders with EUR/USD instrument, but history.getOrderHistory still returns nothing - send message to [email protected] with your login details.


 
 Post subject: Re: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Tue 25 Sep, 2018, 04:57 

User rating: 2
Joined: Mon 30 Apr, 2018, 12:38
Posts: 17
Location: ChinaChina
API Support wrote:
Checked, strategy sample works properly. Please recheck. If you sure that in previous week you made a orders with EUR/USD instrument, but history.getOrderHistory still returns nothing - send message to [email protected] with your login details.


Thanks for reply. Rechecked and still get no history information. I tested it in live account(hedging account,not global account) ,then I created demo account(DEMO2BezKE) and no information too.


 
 Post subject: Re: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Wed 26 Sep, 2018, 02:54 

User rating: 2
Joined: Mon 30 Apr, 2018, 12:38
Posts: 17
Location: ChinaChina
Thanks for reply,my created demo account is: DEMO2BezKE ,password is:BezKE. And I opened and closed several orders yesterday, but I still get nothing information about order.
The followings are position reports of the demo account:
Position Type Position ID Side Instrument Amount Open Price Close Price P/L Swaps Swap (USD) Gross P/L Gross P/L (USD) Commission (USD) Open Date Close Date
Regular 158840528 LONG EUR/USD 10,000.00 1.17517 1.17508 -0.90 USD 0.00 USD 0.00 -0.90 USD -0.90 -0.82 25.09.2018 01:44:57 25.09.2018 01:45:37
Regular 158840537 SHORT EUR/USD -1,000.00 1.17506 1.17488 0.18 USD 0.00 USD 0.00 0.18 USD 0.18 -0.08 25.09.2018 01:45:49 25.09.2018 01:47:32
Regular 158840544 SHORT EUR/USD -1,000.00 1.17485 1.1749 -0.05 USD 0.00 USD 0.00 -0.05 USD -0.05 -0.08 25.09.2018 01:47:43 25.09.2018 01:47:50
Regular 158840549 SHORT EUR/USD -84,962.00 1.17489 1.17498 -7.65 USD 0.00 USD 0.00 -7.65 USD -7.65 -6.98 25.09.2018 01:48:07 25.09.2018 01:48:20


and the following is history test result with attached java.
00:00:00 System time is: Wed Sep 26 01:41:50 UTC 2018
no other information.
Also I test wiki samples: "order history over last 10 bars "(URL:https://www.dukascopy.com/wiki/en/development/strategy-api/historical-data/order-history) and
"order transaction history"(URL:https://www.dukascopy.com/wiki/en/development/strategy-api/historical-data/examples). I also gets no information about history orders.
the messages of "order transaction history" are:
2018-09-17 00:00:00 No trasactions were found within the selected period
2018-09-17 00:00:00 Active (Created/Opened/Filled) order count at 2018-09-26 01:48:21.256 is 0
2018-09-17 00:00:00 History (Closed/Cancelled) order count from 2018-09-19 01:48:21.256 to 2018-09-26 01:48:21.256 is 0


I don't know why, and thanks for continuous help.


 
 Post subject: Re: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Wed 26 Sep, 2018, 11:57 

User rating: 2
Joined: Mon 30 Apr, 2018, 12:38
Posts: 17
Location: ChinaChina
I found the problem.
The messages only show in local run/remote run environment, DO NOT show in the historical test environment.
And Can do some improvement, let the messages shows in test environment?


 
 Post subject: Re: history.getOrderHistory returns nothing,WHY? Post rating: 0   New post Posted: Thu 04 Oct, 2018, 09:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Historical Tester for each tester action creates new History instance. It stores only orders executed by your strategy in testing process and has no relation to real data.


 

Jump to:  

cron
  © 1998-2024 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