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.

Fills.. is there any Trade ID
 Post subject: Fills.. is there any Trade ID Post rating: 0   New post Posted: Thu 23 Feb, 2012, 11:44 

User rating: 1
Joined: Thu 23 Feb, 2012, 11:22
Posts: 23
Hi Everyone,

I'm new to Jforex and java so it has been a steep learning curve, but I've managed to get connected, submit and close orders so far..

I'm now trying to log fills..

Is there any execution ID or Trade ID to identify each individual fill? So I don’t record the same fill more than once?

I'm getting the initial fill from IMessage. if the connection goes down and a fill is missed what is the best way to retrieve all fills for the last x period?

Thanks in advance

Regards

Mark


 
 Post subject: Re: Fills.. is there any Trade ID Post rating: 0   New post Posted: Thu 23 Feb, 2012, 14:37 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Order_history
Also see an example:
https://www.dukascopy.com/wiki/#Order_tr ... on_history


 
 Post subject: Re: Fills.. is there any Trade ID Post rating: 0   New post Posted: Sun 26 Feb, 2012, 07:08 

User rating: 1
Joined: Thu 23 Feb, 2012, 11:22
Posts: 23
Thanks Support,

I have perused the LastTransaction strategy in the link provided and studied the Market Order States Diagram.

I have a few questions for a partial fill scenario..

//1) make an order to buy on stop with SL

order = engine.submitOrder("order1", instrument, IEngine.OrderCommand.BUYSTOP, 1.000 , price, slippage, stopLossPrice, 0);

Entry stop is hit,

Partial fill buy 0.2

IOrder.State = “FILLED”
Order.getAmount() = 0.2
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK

fill buy 0.8

IOrder.State = “FILLED”
Order.getAmount() = 1.0
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK

Order.getAmount() = getRequestAmount(), so entry complete.

At this point it is unclear to me what happen with the IOrder.State, Order.getAmount(),getRequestAmount()?
Is the Order.getAmount() reset to zero for closing the position? Is there a way of telling if the fill was a buy or a sell?

Stop loss price is hit

Partial fill sell 0.3

IOrder.State = “FILLED” or “CLOSED” ????
Order.getAmount() = 0.3 ????
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK ?? or now IHistory to get fill??

Partial fill sell 0.7

IOrder.State = “CLOSED” ????
Order.getAmount() = 1.0 ????
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK ?? or now IHistory to get fill??
onMessage ORDER_CLOSE_OK ??

Order.getAmount() = getRequestAmount(), so exit complete and order closed..

Regards

Mark


 
 Post subject: Re: Fills.. is there any Trade ID Post rating: 0   New post Posted: Mon 27 Feb, 2012, 10:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
markg wrote:
//1) make an order to buy on stop with SL

order = engine.submitOrder("order1", instrument, IEngine.OrderCommand.BUYSTOP, 1.000 , price, slippage, stopLossPrice, 0);

Entry stop is hit,

Partial fill buy 0.2

IOrder.State = “FILLED”
Order.getAmount() = 0.2
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK

fill buy 0.8

IOrder.State = “FILLED”
Order.getAmount() = 1.0
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK

Order.getAmount() = getRequestAmount(), so entry complete.

At this point it is unclear to me what happen with the IOrder.State, Order.getAmount(),getRequestAmount()?
They are as you described above.
markg wrote:
Is the Order.getAmount() reset to zero for closing the position?
No, it remains 1.0.
markg wrote:
Is there a way of telling if the fill was a buy or a sell?
IOrder.isLong.

markg wrote:
Stop loss price is hit
Partial fill sell 0.3

IOrder.State = “FILLED” or “CLOSED” ????
Order.getAmount() = 0.3 ????
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK ?? or now IHistory to get fill??

Partial fill sell 0.7

IOrder.State = “CLOSED” ????
Order.getAmount() = 1.0 ????
getRequestAmount() = 1.0
onMessage ORDER_FILL_OK ?? or now IHistory to get fill??
onMessage ORDER_CLOSE_OK ??

Order.getAmount() = getRequestAmount(), so exit complete and order closed..
IOrder represents a postion - the main order with attached SL and TP conditional orders, thus:
Partial close on SL sell 0.3:
IOrder.State = “FILLED”
Order.getAmount() = 0.7
getRequestAmount() = 1.0
onMessage ORDER_CLOSE_OK (as in the case of partical close)

Full close on SL sell 0.7:
IOrder.State = “CLOSED”
Order.getAmount() = 1.0
getRequestAmount() = 1.0
onMessage ORDER_CLOSE_OK
now IHistory to get fill


 
 Post subject: Re: Fills.. is there any Trade ID Post rating: 0   New post Posted: Tue 28 Feb, 2012, 07:56 

User rating: 1
Joined: Thu 23 Feb, 2012, 11:22
Posts: 23
Hi Support,

Please clarify is IOrder.isLong = True for a long position or True indicating a Buy..

In the scenario described above is IOrder.isLong = True for the entire trade including the entry fills and exit fills or does it change state to false when selling, closing the long position?

If IOrder.isLong = True for the duration of the trade, entry and exit fills.. how can I tell if the fill is a buy or sell?

Sorry if I’m missing something here

Regards

Mark


 
 Post subject: Re: Fills.. is there any Trade ID Post rating: 0   New post Posted: Wed 29 Feb, 2012, 17:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
markg wrote:
Please clarify is IOrder.isLong = True for a long position or True indicating a Buy..
It indicates that the position is LONG.
markg wrote:
In the scenario described above is IOrder.isLong = True for the entire trade including the entry fills and exit fills or does it change state to false when selling, closing the long position?
The setting solely depends on IOrder.getOrderCommand - if it is BUY*, SELL*, BID or OFFER which gets set at the creation of the order and does not change there after.


 

Jump to:  

  © 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