Setup basic Alpaca action fetch and test.
This commit is contained in:
@ -1,6 +1,21 @@
|
||||
import { describe, expect, test } from '@jest/globals';
|
||||
import 'dotenv/config';
|
||||
import { AlpacaExchange } from '../src/index';
|
||||
import { ActionFetchOptions, AlpacaExchange } from '../src/index';
|
||||
import { createLogger, transports, format } from "winston";
|
||||
|
||||
const logger = createLogger({
|
||||
transports: [new transports.Console()],
|
||||
format: format.combine(
|
||||
format.colorize(),
|
||||
format.timestamp(),
|
||||
format.printf(({ timestamp, level, message, service }) => {
|
||||
return `[${timestamp}] ${service} ${level}: ${message}`;
|
||||
})
|
||||
),
|
||||
defaultMeta: {
|
||||
service: "AlpacaTest",
|
||||
},
|
||||
});
|
||||
|
||||
describe('Alpaca Tests', () => {
|
||||
test('portfolio fetch', () => {
|
||||
@ -16,4 +31,11 @@ describe('Alpaca Tests', () => {
|
||||
const exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true);
|
||||
expect(exchange.quoteProvider.fetchQuote("AAPL")).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
test('action fetch', async () => {
|
||||
expect(process.env.ALPACA_API_KEY).toBeDefined();
|
||||
expect(process.env.ALPACA_SECRET_KEY).toBeDefined();
|
||||
const exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true);
|
||||
expect(exchange.actionProvider.fetchActions(new ActionFetchOptions)).resolves.toBeDefined();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user