-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
79 lines (74 loc) · 1.83 KB
/
types.ts
File metadata and controls
79 lines (74 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Enum for Position Side
export enum PositionSide {
LONG = 'LONG',
SHORT = 'SHORT'
}
// Interface matching all_accounts.csv
export interface AccountData {
power: number;
max_power_short: number;
net_cash_power: number;
total_assets: number;
securities_assets: number;
fund_assets: number;
bond_assets: number;
cash: number;
market_val: number;
long_mv: number;
short_mv: number;
pending_asset: number;
interest_charged_amount: number;
frozen_cash: number;
avl_withdrawal_cash: number | string; // Can be N/A
currency: string;
unrealized_pl: number | string; // Can be N/A
realized_pl: number | string; // Can be N/A
risk_status: string;
initial_margin: number;
maintenance_margin: number;
total_pl_unrealized_options: number;
total_pl_unrealized_stocks: number;
total_pl_realized_stocks: number;
total_pl_potential: number;
}
// Interface matching all_positions.csv
export interface PositionData {
code: string;
stock_name: string;
position_market: string;
qty: number;
can_sell_qty: number;
cost_price: number;
cost_price_valid: boolean;
average_cost: number;
diluted_cost: number;
market_val: number;
nominal_price: number; // Current Price
pl_ratio: number;
pl_ratio_valid: boolean;
pl_val: number;
pl_val_valid: boolean;
today_pl_val: number;
position_side: PositionSide | string;
unrealized_pl: number;
realized_pl: number;
currency: string;
percentage_of_portfolio: number | null;
}
export interface SortConfig {
key: keyof PositionData;
direction: 'asc' | 'desc';
}
// Categorical Analysis types
export interface CategoricalGroup {
id: string;
name: string;
tickers: string[];
subGroups: Record<string, string>; // Maps ticker to sub-group name
}
export interface SubGroupData {
name: string;
value: number;
percentage: number;
tickers: string[];
}