Jump to content
Sign in to follow this  
SirNewton

List of pairs corresponding to the numbers

Recommended Posts

It looks like instead of pairs (i.e. EURUSD), I need to use numbers like 401166448 to get historical data.

See: https://ciapi.cityindex.com/TradingAPI/market/401166448/barhistory?

Where can I get a list of pairs corresponding to the numbers?

Share this post


Link to post

Hiello,

Yes, you need to use MarketIDs to request the historical price data for a market.

How do I find the unique identifier for a market?

Every market that we offer for trading has a unique identifier known as the Market ID. The Market ID enables you to reference this market for operations such as: subscribing to live streaming prices, place a trade/order, or retrieving price history.

Use the following process to find the Market ID for any market:

  1. Perform a search with the ListMarketSearch service to find the market of interest.
  2. The search response contains the summarised MarketId and Name properties.

 

 Kind Regards, PM

Share this post


Link to post

Hello Physicsman,

Thanks for your response. I tried the link you gave "http://faq.labs.gaincapital.com/topic/HTTP Services/ListMarketSearch.htm" and I see below error:

Sorry, there is a problem

The page you requested does not exist

Error code: 1S160/2

 

When I go to "http://docs.labs.cityindex.com/" I get:
404 Not Found: Requested route ('docs.labs.cityindex.com') does not exist.


When I go to "http://docs.labs.gaincapital.com/" I get:
404 Not Found: Requested route ('docs.labs.gaincapital.com') does not exist.

Any ideas what is going on? 

 

Share this post


Link to post

Hi,

Apologies, the API documentation site is down temporarily and will be up again hopefully next week. In the meantime, please use the attached PDF file, which is a full export of the documentation from the site. Once the site is back online then you can use that again. 

CIAPI User Guide.pdf

Kind Regards, PM

Share this post


Link to post
7 hours ago, Physicsman said:

Hi,

Apologies, the API documentation site is down temporarily and will be up again hopefully next week. In the meantime, please use the attached PDF file, which is a full export of the documentation from the site. Once the site is back online then you can use that again. 

CIAPI User Guide.pdf

Kind Regards, PM

It's going to be a great PITA for that missing documentation URL. How difficult it is to put a landing HTML stating the documentation is under maintenance in the meantime download the PDF with the Link to the PDF?

It's a 10 minute's job for any web developer / html coder - question is how Agile is your Web Development Team. 

Share this post


Link to post

Hello Physicsman,

Thank you for the PDF. I found what I need, but I do have a question.

According to the PDF Page 130 of 375, we have this:

GBP/USD (401166448)
EUR/USD (401166447)
EUR/GBP (401203190)
GBP/JPY (401203133)

But, once I used the query "https://ciapi.cityindex.com/TradingAPI/market/search?SearchByMarketName=TRUE&Query=..." on Postman, I got different market IDs.

GBP/USD Got 401484392
EUR/USD Got 401484347
EUR/GBP Got 401484335
GBP/JPY Got 401484385

Why is this the case? Does the market IDs of the pairs change frequently?

Share this post


Link to post

Hi,

MarketIDs for a market such as GBP/USD will differ between brands, such as FOREX.com US or City Index. The market IDs in the documentation are examples not to be used in a cut and paste manner.

Market IDs for non-expiring markets do not change, although futures bases expiring markets will have different IDs for new contract months. EG. May Wheat ID will differe from July Wheat.

Kind Regards, PM 

Share this post


Link to post

This is an problem. I just ran API "TradingAPI/market/401484392/barhistory?interval=DAY&span=1&PriceBars=1&PriceType=MID" and I got below:

{
    "PriceBars": [
        {
            "BarDate""/Date(1611187200000)/",
            "Open"1.36547,
            "High"1.3746,
            "Low"1.36496,
            "Close"1.37326
        }
    ],
    "PartialPriceBar": {
        "BarDate""/Date(1611273600000)/",
        "Open"1.37327,
        "High"1.37363,
        "Low"1.3636,
        "Close"1.36821
    }
}
 
1611187200000 is datetime 2021-01-20 16:00:00
1611273600000 is datetime 2021-01-21 16:00:00
 
Where is the EOD for 2021-01-22? The market has closed, I expect to get the EOD for today. Why is it missing? Also, 16 hundred hours is at PST, EST, GMT?
 
 

Share this post


Link to post

Hello,

1) All clients use the same API, regardless of which brand they are with. That is why you have to use the correct Market ID for the markets that you can access and trade with your brand.

2)  We use UTC (GMT) as the basis for time - it looks as though you've been converting the time to West Coast USA, which is -8 hours from GMT. When I run the conversion on the first bar above I see it as the bar starting on Thursday 21st Jan at midnight (00:00 hours). 

image.png

 

The second timestamp is the bar starting Friday 22nd Jan.

image.png

The 2nd price bar is the one you want for Friday's OHLC prices. 

Kind Regards, PM

 

Share this post


Link to post

Thank you Physicsman. In python, I was doing below for conversion:

from datetime import datetime

dateconv = datetime.fromtimestamp(1611273600000 / 1e3)
print(dateconv)

I should have been doing:

from datetime import datetime

dateconv = datetime.utcfromtimestamp(1611273600000 / 1e3)
print(dateconv)

Share this post


Link to post
On 20.01.2021 at 5:04 PM, Physicsman said:

Hiello,

Yes, you need to use MarketIDs to request the historical price data for a market.

How do I find the unique identifier for a market?

Every market that we offer for trading has a unique identifier known as the Market ID. The Market ID enables you to reference this market for operations such as: subscribing to live streaming prices, place a trade/order, or retrieving price history.

Use the following process to find the Market ID for any market:

  1. Perform a search with the ListMarketSearch service to find the market of interest.
  2. The search response contains the summarised MarketId and Name properties.

 

 Kind Regards, PM

Hello,

Is there any way to find Market ID's for expired markets? ListMarketSearch returns only current (non-expired) markets, e.g. Copper (per 0.05) May 21 CFD, which has relatively short data history for testing purposes.

Thanks.

Share this post


Link to post

Hello dg97,

Unfortunately no. Once a market is expired it is no longer on our Live databases so cannot be queried via the API.

Kind Regards, PM

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×