Mida
Mida copied to clipboard
Historic Data
Is there a way to get historic data offered by the broker/exchange, let's say the 5m chart from a month back?
You can use getSymbolPeriods() but the amount of returned candles is at the trading platform discretion. On cTrader you will receive the latest 200 candles, with the next update this limit can be increased.
import { MidaTimeframe, } from "@reiryoku/mida";
const m5Candles = await myAccount.getSymbolPeriods("EURUSD", MidaTimeframe.M5);
This does indeed work, but I was thinking something like give me 5m candles from 8th of March to 16th of March on GBPUSD. Binance has this kind of stuff, but I don't know if cTrader has it and how much data they share.
I see, we could design a specific API for requesting long historic data. Of course the availability of this API depends on the trading platform.
We could add this optional API to trading accounts
class MidaTradingAccount {
getHistoricPeriods (fromTimestamp: number, toTimestamp: number, symbol: string, timeframe: number): Promise<MidaPeriod[]>;
getHistoricTicks (fromTimestamp: number, toTimestamp: number, symbol: string): Promise<MidaTick[]>;
}
What do you think? I will leave this issue open to discuss the design.
This is a good idea. Don't know how much of this data is available from them officially. One other approach would be to find a historic data provider that has an API and integrate it into Mida for historic data. I know for a fact that for crypto these kind of services exist for a subscription fee or by data quantity.
@Vasile-Peste Hello, very good idea, when do you think the development will be done ?