-
-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I clicked "Open in new tab" and received this:
Expected behavior
A sidebar with error explanation.
Original error
Argument of type '{ intervalInMillis: number; }' is not assignable to parameter of type 'ExchangeCandleImportRequest'.
Type '{ intervalInMillis: number; }' is missing the following properties from type 'ExchangeCandleImportRequest': startTimeFirstCandle, startTimeLastCandle
Code
import {ms, CurrencyPair, getAlpacaClient} from '@typedtrader/exchange';
// Request: SHOP,USD 1h
export default async (request: string) => {
if (!process.env.ALPACA_LIVE_API_KEY) {
return;
}
if (!process.env.ALPACA_LIVE_API_SECRET) {
return;
}
const spaceIndex = request.indexOf(' ');
const pairPart = request.slice(0, spaceIndex);
const commaIndex = pairPart.indexOf(',');
const base = pairPart.slice(0, commaIndex);
const counter = pairPart.slice(commaIndex + 1);
const pair = new CurrencyPair(base, counter);
const interval = request.slice(spaceIndex + 1);
const intervalInMillis = ms(interval);
const client = getAlpacaClient({
apiKey: process.env.ALPACA_LIVE_API_KEY,
apiSecret: process.env.ALPACA_LIVE_API_SECRET,
usePaperTrading: false,
});
const candle = await client.getCandles(pair, {
intervalInMillis,
});
return JSON.stringify({pair, interval, intervalInMillis});
};Screenshots

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working