Resolve "Create universal interface for exchange data" #22
9
src/exchange.ts
Normal file
9
src/exchange.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Account } from "./interface/account";
|
||||||
|
import {Quote} from "./interface/quote"
|
||||||
|
|
||||||
|
interface Exchange {
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
fetchAccounts: () => Account[];
|
||||||
|
fetchQuote: (symbol: string) => Quote;
|
||||||
|
}
|
3
src/interface/account.ts
Normal file
3
src/interface/account.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export interface Account {
|
||||||
|
fetchPortfolio: () => Portfolio;
|
||||||
|
}
|
17
src/interface/portfolio.ts
Normal file
17
src/interface/portfolio.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export interface Position {
|
||||||
|
readonly symbol: string;
|
||||||
|
|
||||||
|
readonly quantity: number;
|
||||||
|
|
||||||
|
readonly dateAcquired: Date;
|
||||||
|
|
||||||
|
readonly pricePaid: number;
|
||||||
|
readonly price: number;
|
||||||
|
|
||||||
|
readonly change: number;
|
||||||
|
readonly changePct: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Portfolio {
|
||||||
|
readonly positions: Position[];
|
||||||
|
}
|
3
src/interface/quote.ts
Normal file
3
src/interface/quote.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export class Quote {
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user