Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

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

Swap
 Post subject: Swap Post rating: 0   New post Posted: Fri 15 Jun, 2018, 21:41 
User avatar

User rating: 0
Joined: Sat 29 Dec, 2012, 19:01
Posts: 22
Location: Czech Republic, Praha
Hi community and support.
Does anyone know how to get swap for opened as well as already closed orders? I can not find anything in IOrder class, but only commision.

Any help appreciated.

T.


 
The Best Answer  Post subject: Re: Swap Post rating: 1   New post Posted: Sat 16 Jun, 2018, 08:39 

User rating: 14
Joined: Thu 20 Apr, 2017, 22:42
Posts: 141
Location: Russian Federation,
I think the most correct way is
IContext.getReportService() -> getOpenPositions() | getClosedPositions() -> getSwaps()

Another way - evaluate difference in price of 'first open' and 'last open' in IOrder.getFillHistory()' and calculate amount of money out of that. In normal conditions - there is new entry each day with open price adjusted with nightly swap pips
    Fill Time:    2018-06-06 23:16:39.000
    Filled:       #0: 2018-06-06 23:16:39.000 -    9000 * 1.1770811
                  #1: 2018-06-07 00:05:50.000 -    9000 * 1.177302
                  #2: 2018-06-08 00:06:46.000 -    9000 * 1.177376

BUT, from practice I see that it DOES NOT always work this way. Rather frequently 'fill history' contains only 'initial' fill for orders lasting many days.


 
 Post subject: Re: Swap Post rating: 0   New post Posted: Sat 16 Jun, 2018, 10:57 
User avatar

User rating: 0
Joined: Sat 29 Dec, 2012, 19:01
Posts: 22
Location: Czech Republic, Praha
Cheers mtnfx, thats's exactly what I needed.

mtnfx wrote:
I think the most correct way is
IContext.getReportService() -> getOpenPositions() | getClosedPositions() -> getSwaps()

Another way - evaluate difference in price of 'first open' and 'last open' in IOrder.getFillHistory()' and calculate amount of money out of that. In normal conditions - there is new entry each day with open price adjusted with nightly swap pips
    Fill Time:    2018-06-06 23:16:39.000
    Filled:       #0: 2018-06-06 23:16:39.000 -    9000 * 1.1770811
                  #1: 2018-06-07 00:05:50.000 -    9000 * 1.177302
                  #2: 2018-06-08 00:06:46.000 -    9000 * 1.177376

BUT, from practice I see that it DOES NOT always work this way. Rather frequently 'fill history' contains only 'initial' fill for orders lasting many days.


 
 Post subject: Re: Swap Post rating: 0   New post Posted: Thu 01 Aug, 2019, 08:41 
User avatar

User rating: 1
Joined: Wed 31 Jul, 2019, 14:43
Posts: 6
Location: Thailand, Nongchok
for Swap I Like to Buy USDCHF :D :D


 

Jump to:  

  © 1998-2011 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