|
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.
placing orders |
lightmass
|
Post subject: placing orders |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 18:18
|
|
User rating: -
|
Hi,
I am interesting in seeing an example of a strategy placing bid and ask orders (making markets) at given predefined pips away from the best bid and ask prices.
Thanks!
|
|
|
|
 |
SFXbernhard
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 09:11
|
|
User rating: 21
Joined: Thu 19 May, 2011, 20:50 Posts: 413 Location: Germany, Munich
|
Hi, We can write you a program like that in about 1 h. It contains all comments so you can proceed. Please contact me if you are interested. [email protected]Regards Bernhard
|
|
|
|
 |
API Support
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 15:33
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Could you please elaborate an example of a strategy you want.
|
|
|
|
 |
lightmass
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Sat 19 Nov, 2011, 20:51
|
|
User rating: -
|
Sure,
I need a simple example doing the following (the logic does not need to make too much sense):
1) Placing bid and offer orders (this one I think know how to do it), something like this inside onTick()
engine.submitOrder(myLabel, instrument, IEngine.OrderCommand.PLACE_BID, amount, myBidPrice, 0, tick.getBid()- instrument.getPipValue() * 100, tick.getBid()+ instrument.getPipValue() * 150); engine.submitOrder(myLabel, instrument, IEngine.OrderCommand.PLACE_OFFER, amount, myAskPrice 0, tick.getAsk()+ instrument.getPipValue() * 100, tick.getAsk()- instrument.getPipValue() * 150);
where myBidPrice can be anything around tick.getBid() (analogously for myAskPrice).
2) Cancelling old orders. I do not know how to do this. I know that an order can have its IOrder.State set to CANCELED but I could not find the interface in your documentation to actually cancel a CREATED order. In order to make markets I need to be able to place orders close to the best bid and ask and cancel them as the market moves.
3) Clarify if tick.getBids(); tick.getAsks() return the bid and ask orders including my own ones or only including the ones from other market makers.
Regards, lightmass
|
|
|
|
 |
API Support
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Mon 21 Nov, 2011, 09:25
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
2) When IOrder.getOrder is closed, its state will change to canceled, if it has not been filled. For more details, please, see https://www.dukascopy.com/wiki/index.php ... %20diagram. 3) In LIVE client the results of tick.getBids() and tick.getAsks() methods include your orders. Whereas in DEMO mode tick.getBids() and tick.getAsks() methods do not include your orders.
|
|
|
|
 |
lightmass
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Mon 21 Nov, 2011, 22:04
|
|
User rating: -
|
Thanks,
We are making progress! Now, from what you explain I have to write different code for DEMO vs. LIVE when I look at the bids and asks. Is this not something that you should fix? And if there are no plans to fix this could you please indicate how can I programmatically detect if the strategy is running live or not?
I have other question:
Imagine I place an order at a given price and then after a while I want to add more more volume at the same price level so I send another place. Assuming I am the only one at that price level (or more generally nobody placed any order at the same price level in-between my two orders): Is it possible to merge the two orders into one?
Regards, lightmass
|
|
|
|
 |
API Support
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Tue 22 Nov, 2011, 09:23
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
lightmass wrote: Is this not something that you should fix? Objective of DEMO is to reflect prices and volumes of LIVE. If DEMO orders were to influence the DEMO market then such reflection would no more be the case. lightmass wrote: And if there are no plans to fix this could you please indicate how can I programmatically detect if the strategy is running live or not? See: https://www.dukascopy.com/wiki/index.php ... nformationlightmass wrote: Imagine I place an order at a given price and then after a while I want to add more more volume at the same price level so I send another place. Assuming I am the only one at that price level (or more generally nobody placed any order at the same price level in-between my two orders): Is it possible to merge the two orders into one? If the order has not been filled yet then you can change the order's amount. If it has been filled then you can merge the order with another filled order, see: https://www.dukascopy.com/wiki/index.php?title=Merge_Positions
|
|
|
|
 |
lightmass
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Tue 22 Nov, 2011, 23:21
|
|
User rating: -
|
Hi,
I can see the topic in viewtopic.php?f=65&t=43632 but I cannot reply there. When I press the reply button it jumps immediately to the main page. So I will reply here with more questions:
1) Thanks for the info about the account type. 2) You say "If the order has not been filled yet then you can change the order's amount." Do you do this with IOrder.setRequestedAmount()? 3) If I placed an order, lets say a bid, at a given price that is empty and someone else places another bid later then I am first your priority queue for that price. If later I change the order's amount, do I lose my place on the priority queue? 4) I could not find any interface to see the trades in the market. Other ECN's provide this information with some delay. Do you have plans to provide this info or is your policy not to show the trades?
Regards, lightmass
|
|
|
|
 |
API Support
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Wed 23 Nov, 2011, 14:22
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
lightmass wrote: I can see the topic in viewtopic.php?f=65&t=43632 but I cannot reply there. When I press the reply button it jumps immediately to the main page. Please register to reply in that forum section. lightmass wrote: 2) You say "If the order has not been filled yet then you can change the order's amount." Do you do this with IOrder.setRequestedAmount()? Yes. lightmass wrote: 3) If I placed an order, lets say a bid, at a given price that is empty and someone else places another bid later then I am first your priority queue for that price. If later I change the order's amount, do I lose my place on the priority queue? There is no priority queue for bid and offers - order fill is up to chance if there is some concurrency of two orders at the same price. lightmass wrote: 4) I could not find any interface to see the trades in the market. Other ECN's provide this information with some delay. Do you have plans to provide this info or is your policy not to show the trades? We do not have such plans. Consider using volume values both for ticks and bars.
|
|
|
|
 |
lightmass
|
Post subject: Re: placing orders |
Post rating: 0
|
Posted: Wed 23 Nov, 2011, 23:34
|
|
User rating: -
|
Thanks,
You have been very helpful.
Regards, lightmass
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|