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.

Natural Ordering + Instrument
 Post subject: Natural Ordering + Instrument Post rating: 0   New post Posted: Wed 26 Jan, 2011, 16:28 

User rating: 0
Joined: Thu 02 Dec, 2010, 16:55
Posts: 15
Can someone explain the logic behind the natural ordering of the Instruments?

For example, take

this.context.getSubscribedInstruments().toArray();

This will return an array of instruments (as Objects).

If you then do Arrays.sort() on the array, it sorts based on natural ordering. Natural ordering is implemented via compareTo() from the interface Comparable.

The ordering isn't alphabetical. It doesn't order based on the primary instrument vs secondary instrument.

For example, AUD/JPY, AUD/NZD, AUD/USD come first... then lots of others, then after USD/JPY once again we get AUD/CAD and AUD/CHF.

What is the order based on?


 
 Post subject: Re: Natural Ordering + Instrument Post rating: 0   New post Posted: Fri 10 Jun, 2011, 14:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is made up from sequentially added chunks of currency pairs, i.e. new instruments get added at the end of the instrument list, instead of inserting them in the middle of it just for the sake of alphabetical ordering.


 

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