quantvn 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of quantvn might be problematic. Click here for more details.

@@ -0,0 +1,146 @@
1
+ from __future__ import annotations
2
+
3
+ # Public constants/helpers
4
+ from .const import * # noqa: F401,F403
5
+
6
+ # Core helpers (do NOT import merge_fund_into_price here to avoid hard dependency)
7
+ from .core import (
8
+ add_all_fund_features,
9
+ add_all_ta_features,
10
+ fund_feature,
11
+ merge_fund_into_price,
12
+ send_request,
13
+ )
14
+
15
+ # Derivatives theme
16
+ from .derivatives import get_hist as get_derivatives_hist
17
+
18
+ # Stocks theme (consolidated)
19
+ from .stocks import (
20
+ FX,
21
+ MSN,
22
+ Company,
23
+ Crypto,
24
+ Finance,
25
+ Fund,
26
+ Global,
27
+ Listing,
28
+ Quote,
29
+ Trading,
30
+ WorldIndex,
31
+ )
32
+ from .stocks import get_hist as get_stock_hist
33
+ from .stocks import list_liquid_asset
34
+
35
+ # Other helpers
36
+ from .utils import * # noqa: F401,F403
37
+
38
+ # Backward-compatibility: default get_hist refers to stocks
39
+ get_hist = get_stock_hist
40
+
41
+
42
+ # ========== Dynamic single-feature API (module-level) ==========
43
+ # ========== Dynamic single-feature API (module-level) ==========
44
+ def __getattr__(name: str):
45
+ # Fallback: danh sách feature hợp lệ nếu core không export _FUND_CANONICAL_NAMES
46
+ _fallback = {
47
+ "earningPerShare",
48
+ "bookValuePerShare",
49
+ "roe",
50
+ "roa",
51
+ "priceToEarning",
52
+ "priceToBook",
53
+ "interestMargin",
54
+ "nonInterestOnToi",
55
+ "badDebtPercentage",
56
+ "provisionOnBadDebt",
57
+ "costOfFinancing",
58
+ "equityOnTotalAsset",
59
+ "equityOnLoan",
60
+ "costToIncome",
61
+ "equityOnLiability",
62
+ "assetOnEquity",
63
+ "preProvisionOnToi",
64
+ "postTaxOnToi",
65
+ "loanOnEarnAsset",
66
+ "loanOnAsset",
67
+ "loanOnDeposit",
68
+ "depositOnEarnAsset",
69
+ "badDebtOnAsset",
70
+ "liquidityOnLiability",
71
+ "payableOnEquity",
72
+ "cancelDebt",
73
+ "creditGrowth",
74
+ "earningPerShare_yoy",
75
+ "earningPerShare_yoy_abs",
76
+ "roe_yoy",
77
+ "roe_yoy_abs",
78
+ "roa_yoy",
79
+ "roa_yoy_abs",
80
+ "bookValuePerShare_yoy",
81
+ "bookValuePerShare_yoy_abs",
82
+ "eps_yoy_up",
83
+ "eps_up_4p",
84
+ "cash_on_equity_yoy_up",
85
+ "capex_pos",
86
+ "curr_gt1_5_yoy_up",
87
+ "quick_gt1_yoy_up",
88
+ "int_cov_gt3",
89
+ "bvps_yoy_up",
90
+ "wc_pos_yoy_up",
91
+ "roe_gt15_yoy_up",
92
+ "roa_gt8_yoy_up",
93
+ "asset_turnover_yoy_up",
94
+ "days_inv_yoy_down",
95
+ "days_rec_yoy_down",
96
+ "days_pay_yoy_down",
97
+ "gpa_yoy_up",
98
+ "charter_cap_yoy_up",
99
+ }
100
+ try:
101
+ from .core import _FUND_CANONICAL_NAMES as _names
102
+ except Exception:
103
+ _names = _fallback
104
+
105
+ if name in _names:
106
+ from .core import fund_feature as _fund_feature
107
+
108
+ def _fn(symbol: str, **kwargs):
109
+ return _fund_feature(name, symbol, **kwargs)
110
+
111
+ _fn.__name__ = name
112
+ _fn.__doc__ = (
113
+ f"Return DataFrame: date,time,open,high,low,close,volume,{name} "
114
+ f"for the given symbol. Example: {name}('VCB')."
115
+ )
116
+ return _fn
117
+
118
+ raise AttributeError(name)
119
+
120
+
121
+ __all__ = [
122
+ # helpers
123
+ "send_request",
124
+ # core bulk adders
125
+ "add_all_ta_features",
126
+ "add_all_fund_features",
127
+ "fund_feature",
128
+ # stocks theme
129
+ "Company",
130
+ "Finance",
131
+ "Fund",
132
+ "Listing",
133
+ "Quote",
134
+ "Global",
135
+ "MSN",
136
+ "FX",
137
+ "Crypto",
138
+ "WorldIndex",
139
+ "list_liquid_asset",
140
+ "get_stock_hist",
141
+ "get_hist",
142
+ "Trading",
143
+ # derivatives
144
+ "get_derivatives_hist",
145
+ "merge_fund_into_price",
146
+ ]
@@ -0,0 +1,26 @@
1
+
2
+ TRADING_URL = "https://trading.vietcap.com.vn/api/"
3
+ GRAPHQL_URL = "https://trading.vietcap.com.vn/data-mt/graphql"
4
+ CHART_URL = "chart/OHLCChart/gap-chart"
5
+ INTRADAY_URL = "market-watch"
6
+
7
+ INTERVAL_MAP = {
8
+ '1m':'ONE_MINUTE','5m':'ONE_MINUTE','15m':'ONE_MINUTE','30m':'ONE_MINUTE',
9
+ '1H':'ONE_HOUR','1D':'ONE_DAY','1W':'ONE_DAY','1M':'ONE_DAY'
10
+ }
11
+
12
+ OHLC_COLUMNS = ["t","o","h","l","c","v"]
13
+ OHLC_RENAME = {"t":"time","o":"open","h":"high","l":"low","c":"close","v":"volume"}
14
+
15
+ INTRADAY_MAP = {'truncTime':'time','matchPrice':'price','matchVol':'volume','matchType':'match_type','id':'id'}
16
+
17
+ PRICE_DEPTH_URL = f"{TRADING_URL}{INTRADAY_URL}/AccumulatedPriceStepVol/getSymbolData"
18
+
19
+ PRICE_INFO_MAP = {
20
+ 'ev':'ev','ticker':'symbol',
21
+ 'open_price':'open','ceiling_price':'ceiling','floor_price':'floor','reference_price':'ref_price',
22
+ 'highest_price':'high','lowest_price':'low',
23
+ 'price_change':'price_change','percent_price_change':'price_change_pct',
24
+ 'foreign_total_volume':'foreign_volume','foreign_total_room':'foreign_room','foreign_holding_room':'foreign_holding_room',
25
+ 'average_match_volume2_week':'avg_match_volume_2w',
26
+ }