financegy 3.0__py3-none-any.whl → 3.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: financegy
3
- Version: 3.0
3
+ Version: 3.1
4
4
  Summary: Unofficial Python library for accessing GSE (Guyana Stock Exchange) financial data
5
5
  Author-email: Ezra Minty <ezranminty@gmail.com>
6
6
  License: MIT
@@ -70,7 +70,7 @@ search_results = financegy.search_securities("DDL")
70
70
  # Get all trades for a specific year
71
71
  year_trades = financegy.get_trades_for_year("DDL", "2019")
72
72
 
73
- # Get historical trades within a date range supports: yyyy / mm/yyyy / dd/mm/yyyy
73
+ # Get historical trades within a date range - supports: yyyy / mm/yyyy / dd/mm/yyyy
74
74
  historical_trades = financegy.get_historical_trades(
75
75
  symbol="DDL",
76
76
  start_date="01/06/2020",
@@ -96,6 +96,35 @@ volatility = financegy.get_sessions_volatility("DDL", 30)
96
96
  # Year-to-date high and low traded prices
97
97
  ytd_high_low = financegy.get_ytd_high_low("DDL")
98
98
 
99
+ # --------------------------
100
+ # Portfolio / Position Calculations
101
+ # --------------------------
102
+
103
+ # Calculate the current market value of a position
104
+ position_value = financegy.calculate_position_value("DDL", shares=50)
105
+
106
+ # Calculate unrealized gain or loss for a position
107
+ position_return = financegy.calculate_position_return(
108
+ symbol="DDL",
109
+ shares=50,
110
+ purchase_price=250
111
+ )
112
+
113
+ # Calculate percentage return for a position
114
+ position_return_percent = financegy.calculate_position_return_percent(
115
+ symbol="DDL",
116
+ shares=50,
117
+ purchase_price=250
118
+ )
119
+
120
+ # Portfolio-level summary
121
+ portfolio = [
122
+ {"symbol": "DTC", "shares": 100, "purchase_price": 300},
123
+ {"symbol": "DDL", "shares": 50, "purchase_price": 250},
124
+ ]
125
+
126
+ portfolio_summary = financegy.calculate_portfolio_summary(portfolio)
127
+
99
128
  # --------------------------
100
129
  # Utilities
101
130
  # --------------------------
@@ -117,39 +146,48 @@ financegy.clear_cache(silent=True)
117
146
 
118
147
  ### Core Data Retrieval
119
148
 
120
- | Function | Description |
121
- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
122
- | `get_securities()` | Returns all currently traded securities on the GSE. |
123
- | `get_security_by_symbol(symbol)` | Returns the full security name for a ticker symbol (e.g., `"DDL"` → `"Demerara Distillers Limited"`). |
124
- | `get_recent_trade(symbol)` | Returns the most recent trade information for the given security. |
125
- | `get_security_recent_year(symbol)` | Returns all trade data for the most recent year available for the selected security. |
126
- | `get_session_trades(session)` | Returns trade data for **all** securities during a specific trading session. |
127
- | `get_security_session_trade(symbol, session)` | Returns trade data for a **specific** security during a specific session. |
128
- | `search_securities(query)` | Searches securities whose names or ticker symbols match the given query (partial match). |
129
- | `get_trades_for_year(symbol, year)` | Returns all trade records for a specific security during a given year. |
130
- | `get_historical_trades(symbol, start_date, end_date)` | Returns historical trades within the specified date range (`dd/mm/yyyy`, `mm/yyyy`, or `yyyy`). |
149
+ | Function | Description |
150
+ | ----------------------------------------------------- | ------------------------------------------------------------------------------------ |
151
+ | `get_securities()` | Returns all currently traded securities on the GSE. |
152
+ | `get_security_by_symbol(symbol)` | Returns the full security name for a ticker symbol. |
153
+ | `get_recent_trade(symbol)` | Returns the most recent trade information for the given security. |
154
+ | `get_security_recent_year(symbol)` | Returns all trade data for the most recent year available for the selected security. |
155
+ | `get_session_trades(session)` | Returns trade data for all securities during a specific trading session. |
156
+ | `get_security_session_trade(symbol, session)` | Returns trade data for a specific security during a specific session. |
157
+ | `search_securities(query)` | Searches securities whose names or ticker symbols match the given query. |
158
+ | `get_trades_for_year(symbol, year)` | Returns all trade records for a specific security during a given year. |
159
+ | `get_historical_trades(symbol, start_date, end_date)` | Returns historical trades within the specified date range. |
131
160
 
132
161
  ### Analytics / Calculation Functions
133
162
 
134
- | Function | Description |
135
- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
136
- | `get_previous_close(symbol)` | Returns the most recent closing/last trade price for the security. |
137
- | `get_price_change(symbol)` | Returns absolute price difference between the most recent trade and the previous session close. |
138
- | `get_price_change_percent(symbol)` | Returns percent price change between the most recent trade and the previous session close. |
139
- | `get_latest_session_for_symbol(symbol)` | Returns the latest trade dict for the symbol (includes the latest `session`). |
140
- | `get_sessions_average_price(symbol, session_start, session_end)` | Returns the average last traded price over a session range (inclusive). |
141
- | `get_average_price(symbol, session_number)` | Returns the average last traded price over the last **N** sessions ending at the latest session. |
142
- | `get_sessions_volatility(symbol, session_number)` | Returns volatility over the last **N** sessions using log returns (weekly + annualized). |
143
- | `get_ytd_high_low(symbol)` | Returns year-to-date highest and lowest traded prices for the security. |
163
+ | Function | Description |
164
+ | ---------------------------------------------------------------- | --------------------------------------------------------------- |
165
+ | `get_previous_close(symbol)` | Returns the most recent closing/last trade price. |
166
+ | `get_price_change(symbol)` | Returns absolute price difference vs previous session close. |
167
+ | `get_price_change_percent(symbol)` | Returns percent price change vs previous session close. |
168
+ | `get_latest_session_for_symbol(symbol)` | Returns the latest trade dict for the symbol. |
169
+ | `get_sessions_average_price(symbol, session_start, session_end)` | Returns the average last traded price over a session range. |
170
+ | `get_average_price(symbol, session_number)` | Returns the average last traded price over the last N sessions. |
171
+ | `get_sessions_volatility(symbol, session_number)` | Returns volatility over the last N sessions. |
172
+ | `get_ytd_high_low(symbol)` | Returns year-to-date highest and lowest traded prices. |
173
+
174
+ ### Portfolio / Position Functions
175
+
176
+ | Function | Description |
177
+ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
178
+ | `calculate_position_value(symbol, shares)` | Calculates the current market value of a position using the latest trade price. |
179
+ | `calculate_position_return(symbol, shares, purchase_price)` | Calculates the unrealized gain or loss for a position. |
180
+ | `calculate_position_return_percent(symbol, shares, purchase_price)` | Calculates the percentage return for a position. |
181
+ | `calculate_portfolio_summary(positions)` | Computes a full portfolio summary including totals and per-position breakdown. |
144
182
 
145
183
  ### Utilities
146
184
 
147
- | Function | Description |
148
- | ---------------------------------------------------------------------- | --------------------------------------------------------------- |
149
- | `to_dataframe(data)` | Converts FinanceGY list/dict results into a `pandas.DataFrame`. |
150
- | `save_to_csv(data, filename="output.csv", path=None, silent=False)` | Saves data to a CSV file. |
151
- | `save_to_excel(data, filename="output.xlsx", path=None, silent=False)` | Saves data to an Excel file. |
152
- | `clear_cache(silent=False)` | Completely clears the FinanceGY cache directory. |
185
+ | Function | Description |
186
+ | ---------------------------------------------------------------------- | ------------------------------------------------------------- |
187
+ | `to_dataframe(data)` | Converts FinanceGY list/dict results into a pandas DataFrame. |
188
+ | `save_to_csv(data, filename="output.csv", path=None, silent=False)` | Saves data to a CSV file. |
189
+ | `save_to_excel(data, filename="output.xlsx", path=None, silent=False)` | Saves data to an Excel file. |
190
+ | `clear_cache(silent=False)` | Completely clears the FinanceGY cache directory. |
153
191
 
154
192
  ---
155
193
 
@@ -8,8 +8,8 @@ financegy/helpers/to_float.py,sha256=VVE3fkHzIE2un6zD50au_U2b_Luh13p3-T84fxEE6Xo
8
8
  financegy/modules/portfolio.py,sha256=HFWw1FenJ_pABQhF7OlpP6OXuLCiyQBmwyXLrj-g6WQ,5483
9
9
  financegy/modules/securities.py,sha256=_1f0-aZI7xWH5ndk5KSRVkqage3OpMbxaIod4W1xBy8,14687
10
10
  financegy/utils/utils.py,sha256=mqbjZ4em_a7rZyDgCjFswspEIL_WUPOXa8siAuxZuoY,1434
11
- financegy-3.0.dist-info/licenses/LICENSE,sha256=HGLhx0fI215whUzIvTFdFivB447d_IdIIIRncUCQaEs,1088
12
- financegy-3.0.dist-info/METADATA,sha256=XwV5KpXYnrTusYQKWzHnFwgD4KFNWWggmFwBD1kaKzM,9674
13
- financegy-3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
- financegy-3.0.dist-info/top_level.txt,sha256=TpdYDxtK61m5xnvvzbqnDVJ82gphEqxnXN_Ur8rjvxQ,10
15
- financegy-3.0.dist-info/RECORD,,
11
+ financegy-3.1.dist-info/licenses/LICENSE,sha256=HGLhx0fI215whUzIvTFdFivB447d_IdIIIRncUCQaEs,1088
12
+ financegy-3.1.dist-info/METADATA,sha256=-qczV0iIjIUiI5Y4ouoRYG--hc6c58w-ELSxEFHWQFM,10931
13
+ financegy-3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
+ financegy-3.1.dist-info/top_level.txt,sha256=TpdYDxtK61m5xnvvzbqnDVJ82gphEqxnXN_Ur8rjvxQ,10
15
+ financegy-3.1.dist-info/RECORD,,