|
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.
Error in getAmount() with CFD |
JBxTrade
|
Post subject: Error in getAmount() with CFD |
Post rating: 0
|
Posted: Fri 26 Jul, 2019, 23:11
|
|
User rating: 0
Joined: Fri 26 Jul, 2019, 23:06 Posts: 2 Location: Canada,
|
Hi, Normally when i call the function getAmount() with Forex it's ok, but, when i'm trying with CFD, i got this :
18:57:48 Trade : Thu Jul 25 14:16:21 UTC 2019 Open Price : 318.483 Close Price : 322.508 Amount : 2.0E-5 Pips : 402.5 Profit/Loss : 80.5 $ Commission : 20.0 $
the right number is 20 not 2.0E-5
Can you help me with that ?
With the code :
public void onStart(IContext context) throws JFException { console = context.getConsole();
//String theDateString = "01-01-2018"; SimpleDateFormat timeFormatDate = new SimpleDateFormat("dd-MM-yyyy"); try { beginDate = (Date)timeFormatDate.parse(theDateString); } catch (ParseException e) { console.getOut().println(e); } long beginDateLong = beginDate.getTime(); long time = System.currentTimeMillis(); List<IOrder> orders = context.getHistory().getOrdersHistory(theInstrument, beginDateLong, time); if (orders != null) { for (int i = 0; i <= orders.size() -1; i++) { theDate = new Date(orders.get(i).getCreationTime()); console.getOut().println(" Trade : " + theDate + " Open Price : " + orders.get(i).getOpenPrice() + " Close Price : " + orders.get(i).getClosePrice() + " " + "Amount : " + orders.get(i).getAmount() + " " + " Pips : " + orders.get(i).getProfitLossInPips() + " Profit/Loss : " + orders.get(i).getProfitLossInAccountCurrency() + " $" + " Commission : " + orders.get(i).getCommission() + " $"); } } }
|
|
|
|
|
API Support
|
Post subject: Re: Error in getAmount() with CFD |
Post rating: 0
|
Posted: Mon 29 Jul, 2019, 17:28
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
JBxTrade
|
Post subject: Re: Error in getAmount() with CFD |
Post rating: 0
|
Posted: Mon 29 Jul, 2019, 19:19
|
|
User rating: 0
Joined: Fri 26 Jul, 2019, 23:06 Posts: 2 Location: Canada,
|
Ho ok !
Great !
Thank you !
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|