|
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.
getOrdersHistory(...) problem |
fxer
|
Post subject: getOrdersHistory(...) problem |
Post rating: 0
|
Posted: Fri 01 May, 2015, 23:01
|
|
User rating: 1
Joined: Tue 24 Apr, 2012, 13:41 Posts: 39
|
Hello, I test the code with the following piece: context.setSubscribedInstruments( java.util.Collections.singleton( instrument ), true ); ITick lastTick = history.getLastTick( instrument ); long time = lastTick.getTime();
List<IOrder> previousOrders = history.getOrdersHistory( instrument, time - hoursBack * Period.ONE_HOUR.getInterval(), time ); for( IOrder order : previousOrders ) { console.getOut().println(String.format("%7.5f %7.5f %7.5f %7.5f %5.3f %s", order.getProfitLossInPips(), order.getOpenPrice() - order.getClosePrice(), order.getOpenPrice(), order.getClosePrice(), order.getAmount(), order)); }
The "position report" looks as follows: The problem is, that aforementioned code does not report all closed positions. I can find only position 1, 2 and 5 (numbers in red above and position below marked in bold). Positions 3 and 4 are missing... Quote: 21:19:16 0.00000 0.00000 1.12129 1.12129 0.010 [jf1k8gnt2]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 19:53:20:028, fill price 1.12129, close time: 2015-05-01 19:53:20:326, close price 1.12129 21:19:16 0.00000 0.00000 1.11992 1.11992 0.040 [jf11bb9nc410]-Instrument: EUR/USD, order command: BUY, amount: 0.04, fill time: 2015-05-01 19:53:20:330, fill price 1.119918, close time: 2015-05-01 20:02:46:143, close price 1.119918 21:19:16 2.80000 -0.00028 1.12024 1.12052 0.050 [jf11bb9nc4100]-Instrument: EUR/USD, order command: BUY, amount: 0.05, fill time: 2015-05-01 20:02:46:145, fill price 1.120244, close time: 2015-05-01 20:34:34:739, close price 1.12052 21:19:16 0.00000 0.00000 1.12155 1.12155 0.010 [jft4c05li]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 20:02:45:954, fill price 1.12155, close time: 2015-05-01 20:02:46:143, close price 1.12155 21:19:16 0.00000 0.00000 1.11946 1.11946 0.030 [jf11bb9nc41]-Instrument: EUR/USD, order command: BUY, amount: 0.03, fill time: 2015-05-01 19:51:33:601, fill price 1.11946, close time: 2015-05-01 19:53:20:328, close price 1.11946 21:19:16 0.00000 0.00000 1.11860 1.11860 0.010 [jfc12nmp0]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 18:56:57:080, fill price 1.1186, close time: 2015-05-01 18:56:57:404, close price 1.1186 21:19:16 0.00000 0.00000 1.11862 1.11862 0.010 [jf11bb9nc]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 18:51:27:428, fill price 1.11862, close time: 2015-05-01 18:56:57:403, close price 1.11862 21:19:16 0.00000 0.00000 1.11980 1.11980 0.010 [jfg9ea915]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 16:28:51:970, fill price 1.1198, close time: 2015-05-01 16:29:07:273, close price 1.1198 21:19:16 -4.70000 -0.00047 1.11901 1.11948 0.010 [jf6ry7717]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-01 16:23:14:523, fill price 1.11901, close time: 2015-05-01 16:25:42:519, close price 1.11948 21:19:16 -3.20000 -0.00032 1.11863 1.11895 0.010 [jf1hqyl86]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-01 16:20:47:200, fill price 1.11863, close time: 2015-05-01 16:22:57:118, close price 1.11895 21:19:16 0.00000 0.00000 1.11872 1.11872 0.010 [jf1dzhruk]-Instrument: EUR/USD, order command: BUY, amount: 0.01, fill time: 2015-05-01 16:09:17:549, fill price 1.11872, close time: 2015-05-01 16:29:07:274, close price 1.11872
What might be the problem? Regards, FXer PS This is demo account, Windows 7, Oracle Java 1.8.0-45, Ducascopy Bank ver. 2.44.7, JForex API version. 2.12.9.
Attachments: |
File comment: Position report fragment
Przechwytywanie.PNG [29.98 KiB]
Downloaded 406 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
|
fxer
|
Post subject: Re: getOrdersHistory(...) problem |
Post rating: 0
|
Posted: Mon 04 May, 2015, 18:46
|
|
User rating: 1
Joined: Tue 24 Apr, 2012, 13:41 Posts: 39
|
Hello, The same problem again. Minimal strategy to demonstrate the problem is as follows: package jforex;
import java.math.BigDecimal; import java.util.Iterator; import java.util.List; import java.util.concurrent.TimeUnit;
import com.dukascopy.api.Configurable; import com.dukascopy.api.IAccount; import com.dukascopy.api.IBar; import com.dukascopy.api.IConsole; import com.dukascopy.api.IContext; import com.dukascopy.api.IEngine; import com.dukascopy.api.IHistory; import com.dukascopy.api.IIndicators; import com.dukascopy.api.IMessage; import com.dukascopy.api.IMessage.Type; import com.dukascopy.api.IOrder; import com.dukascopy.api.IStrategy; import com.dukascopy.api.ITick; import com.dukascopy.api.Instrument; import com.dukascopy.api.JFException; import com.dukascopy.api.OfferSide; import com.dukascopy.api.Period; import com.dukascopy.api.util.DateUtils;
public class StrategyTester implements IStrategy { IEngine engine; IConsole console; IHistory history; IContext context; @Override public void onStart( IContext context ) throws JFException { this.context = context; engine = context.getEngine(); console = context.getConsole(); history = context.getHistory();
int hoursBack = 17;
context.setSubscribedInstruments( java.util.Collections.singleton( Instrument.EURUSD ), true ); ITick lastTick = history.getLastTick( Instrument.EURUSD ); long time = lastTick.getTime();
List<IOrder> previousOrders = history.getOrdersHistory( Instrument.EURUSD, time - hoursBack * Period.ONE_HOUR.getInterval(), time ); console.getOut().println( String.format( "Instrument %s, from \"%s\" to \"%s\"", Instrument.EURUSD, DateUtils.format( time - hoursBack * Period.ONE_HOUR.getInterval() ), DateUtils.format( time ) ) ); for( IOrder order : previousOrders ) { console.getOut().println(String.format("%7.5f %7.5f %7.5f %7.5f %5.3f %s", order.getProfitLossInPips(), order.getOpenPrice() - order.getClosePrice(), order.getOpenPrice(), order.getClosePrice(), order.getAmount(), order)); } }
@Override public void onAccount( IAccount account ) throws JFException {}
@Override public void onMessage( IMessage message ) throws JFException {}
@Override public void onStop() throws JFException {}
@Override public void onTick( Instrument instrument, ITick tick ) throws JFException {}
@Override public void onBar( Instrument instrument, Period period, IBar askBar, IBar bidBar ) throws JFException {} }
Strategy output: Quote: 17:34:17 0.00000 0.00000 1.11696 1.11696 0.010 [jf1ksowh1]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-04 13:33:49:800, fill price 1.11696, close time: 2015-05-04 13:33:51:024, close price 1.11696 17:34:17 0.00000 0.00000 1.11882 1.11882 0.010 [jfak3ih1b]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-04 13:17:30:279, fill price 1.11882, close time: 2015-05-04 13:33:51:025, close price 1.11882 17:34:17 -6.10000 -0.00061 1.11676 1.11737 0.010 [jf1bwmkce]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-04 12:53:39:557, fill price 1.11676, close time: 2015-05-04 12:57:26:146, close price 1.11737 17:34:17 1.50000 0.00015 1.11701 1.11686 0.010 [jf10n2nke]-Instrument: EUR/USD, order command: SELL, amount: 0.01, fill time: 2015-05-04 12:39:03:570, fill price 1.11701, close time: 2015-05-04 12:49:21:258, close price 1.11686 17:34:17 Instrument EUR/USD, from "2015-05-04 00:34:16:190" to "2015-05-04 17:34:16:190"
and "position report": Both positions lists are different How to solve or go round the issue? Regards, FXer
Attachments: |
Przechwytywanie.PNG [79.75 KiB]
Downloaded 370 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
|
API Support
|
Post subject: Re: getOrdersHistory(...) problem |
Post rating: 0
|
Posted: Thu 07 May, 2015, 17:57
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Greetings.
Problem is investigated. Will report as soon as fix is available.
Best regards, Support Team.
|
|
|
|
|
API Support
|
Post subject: Re: getOrdersHistory(...) problem |
Post rating: 0
|
Posted: Tue 12 May, 2015, 09:17
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This issue is fixed and will be available in the next JClient version.
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|