Resolve "Implement action fetching for Alpaca" #31

Merged
clbertolini merged 12 commits from 14-implement-action-fetching-for-alpaca into main 2023-11-10 21:36:43 +00:00
Showing only changes of commit 960285e503 - Show all commits

View File

@ -1,6 +1,6 @@
import { describe, expect, test } from '@jest/globals';
import 'dotenv/config';
import { ActionFetchOptions, AlpacaExchange } from '../src/index';
import { ActionDateOptions, ActionDateType, ActionFetchOptions, AlpacaExchange } from '../src/index';
import { createLogger, transports, format } from "winston";
const timeout = 10000;
@ -39,12 +39,12 @@ describe('Alpaca Tests', () => {
expect(process.env.ALPACA_SECRET_KEY).toBeDefined();
const exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true);
const fetchOptions = {};
const fetchOptions = new ActionFetchOptions(undefined, new ActionDateOptions(new Date("2023-10-23T13:30:28.163Z"), ActionDateType.On));
const response = await exchange.actionProvider.fetchActions(new ActionFetchOptions());
const response = await exchange.actionProvider.fetchActions(fetchOptions);
logger.info(JSON.stringify(response));
await expect(exchange.actionProvider.fetchActions(new ActionFetchOptions())).resolves.toBeDefined();
await expect(exchange.actionProvider.fetchActions(fetchOptions)).resolves.toBeDefined();
}, timeout);
});