Mida icon indicating copy to clipboard operation
Mida copied to clipboard

Live prices, periods and indicators

Open Vasile-Peste opened this issue 3 years ago • 0 comments

Introduction

The idea behind this PR is creating an API that provides ready-to-use LIVE market data, for example a self updating array of candlesticks, a self-updating object with bid/ask price for a symbol, and a self-updating indicator.

Example

import { login, createIndicator, makeLiveIndicator, MidaTimeframe, } from "@reiryoku/mida";

const myAccount = await login(/* ... */);
const rsi = await makeLiveIndicator({
    indicator: createIndicator("RSI", { length: 14, }),
    tradingAccount: myAccount,
    input: {
        symbol: "DE40",
        timeframe: MidaTimeframe.H1,
    },
    onUpdate: (event) => {
        console.log(rsi.lastValue);
    },
});

await endLiveIndicator(rsi);

Vasile-Peste avatar Aug 03 '22 14:08 Vasile-Peste