bitfinex-api 0.0.2__tar.gz → 0.0.3__tar.gz

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.
Files changed (24) hide show
  1. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/PKG-INFO +7 -2
  2. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/README.md +6 -1
  3. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/pyproject.toml +1 -1
  4. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/candles/candles.py +12 -4
  5. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/LICENSE +0 -0
  6. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/__init__.py +0 -0
  7. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/__init__.py +0 -0
  8. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/base.py +0 -0
  9. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/candles/__init__.py +0 -0
  10. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/__init__.py +0 -0
  11. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/config.py +0 -0
  12. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/config_base.py +0 -0
  13. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/config_info.py +0 -0
  14. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/config_list.py +0 -0
  15. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/config_map.py +0 -0
  16. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/contracts.py +0 -0
  17. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/treatment/__init__.py +0 -0
  18. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/config/treatment/pair_symbols.py +0 -0
  19. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/misc/__init__.py +0 -0
  20. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/aux/misc/datetime_aux.py +0 -0
  21. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/config.py +0 -0
  22. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/data.py +0 -0
  23. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/exceptions.py +0 -0
  24. {bitfinex_api-0.0.2 → bitfinex_api-0.0.3}/src/bitfinex_api/run_tests.bash +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitfinex-api
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Python API to interact with Bitfinex endpoints
5
5
  License: BSD-3-Clause License
6
6
  License-File: LICENSE
@@ -153,6 +153,8 @@ frame = client.get_trade_candles(
153
153
  | Column | Type (typical) | Description |
154
154
  |--------|----------------|-------------|
155
155
  | ``time`` | UTC timestamp | Bar open time |
156
+ | ``base_symbol`` | str | Request base code (e.g. ``BTC``) |
157
+ | ``quote_symbol`` | str | Request quote code (e.g. ``USD``) |
156
158
  | ``open`` | float | Open |
157
159
  | ``close`` | float | Close |
158
160
  | ``high`` | float | High |
@@ -186,7 +188,10 @@ frame = client.get_trade_candles(
186
188
  limit=100,
187
189
  )
188
190
  assert list(frame.columns) == [
189
- "time", "open", "close", "high", "low", "volume"]
191
+ "time", "base_symbol", "quote_symbol",
192
+ "open", "close", "high", "low", "volume"]
193
+ assert (frame["base_symbol"] == "BTC").all()
194
+ assert (frame["quote_symbol"] == "USD").all()
190
195
  assert frame["time"].min() == pd.Timestamp("2025-12-01", tz="UTC")
191
196
  ```
192
197
 
@@ -135,6 +135,8 @@ frame = client.get_trade_candles(
135
135
  | Column | Type (typical) | Description |
136
136
  |--------|----------------|-------------|
137
137
  | ``time`` | UTC timestamp | Bar open time |
138
+ | ``base_symbol`` | str | Request base code (e.g. ``BTC``) |
139
+ | ``quote_symbol`` | str | Request quote code (e.g. ``USD``) |
138
140
  | ``open`` | float | Open |
139
141
  | ``close`` | float | Close |
140
142
  | ``high`` | float | High |
@@ -168,7 +170,10 @@ frame = client.get_trade_candles(
168
170
  limit=100,
169
171
  )
170
172
  assert list(frame.columns) == [
171
- "time", "open", "close", "high", "low", "volume"]
173
+ "time", "base_symbol", "quote_symbol",
174
+ "open", "close", "high", "low", "volume"]
175
+ assert (frame["base_symbol"] == "BTC").all()
176
+ assert (frame["quote_symbol"] == "USD").all()
172
177
  assert frame["time"].min() == pd.Timestamp("2025-12-01", tz="UTC")
173
178
  ```
174
179
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bitfinex-api"
3
- version = "0.0.2"
3
+ version = "0.0.3"
4
4
  description = "Python API to interact with Bitfinex endpoints"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -27,10 +27,15 @@ class BitfinexAPICandlesMixin:
27
27
  "mts", "open", "close", "high", "low", "volume",]
28
28
  """Columns in the candle response."""
29
29
 
30
- CANDLE_COLUMNS = [
30
+ CANDLE_PAGE_COLUMNS = [
31
31
  "time", "open", "close", "high", "low", "volume",]
32
32
  """Columns in the candle response."""
33
33
 
34
+ CANDLE_COLUMNS = [
35
+ "time", "base_symbol", "quote_symbol", "open", "close", "high",
36
+ "low", "volume",]
37
+ """Columns in the final candle dataframe."""
38
+
34
39
  def validate_time_args(self, start_delta: datetime.timedelta | None,
35
40
  start_datetime: Timestamp | datetime.datetime | str | None, # NOQA
36
41
  end_datetime: Timestamp | datetime.datetime | str | None
@@ -168,9 +173,12 @@ class BitfinexAPICandlesMixin:
168
173
  path = path_template.format(
169
174
  period=period, symbol=trading_symbol)
170
175
 
171
- return self._fetch_candles_paginated(
176
+ trade_response = self._fetch_candles_paginated(
172
177
  path=path, start_ms=start_ms,
173
178
  end_ms=end_ms, limit=limit)
179
+ trade_response['base_symbol'] = base_symbol
180
+ trade_response['quote_symbol'] = quote_symbol
181
+ return trade_response.loc[:, self.CANDLE_COLUMNS]
174
182
 
175
183
  def _fetch_candles_paginated(self, path: str,
176
184
  start_ms: int, end_ms: int, limit: int,
@@ -228,7 +236,7 @@ class BitfinexAPICandlesMixin:
228
236
 
229
237
  frames = [frame for frame in all_candles if not frame.empty]
230
238
  if len(frames) == 0:
231
- return pd.DataFrame(columns=self.CANDLE_COLUMNS)
239
+ return pd.DataFrame(columns=self.CANDLE_PAGE_COLUMNS)
232
240
 
233
241
  # Remove candles after the end_ms
234
242
  all_data = pd.concat(frames, ignore_index=True)
@@ -239,4 +247,4 @@ class BitfinexAPICandlesMixin:
239
247
  all_data["time"] = epoch_ms_to_timestamp(all_data["mts"])
240
248
 
241
249
  # Return the data in the correct columns
242
- return all_data.loc[:, self.CANDLE_COLUMNS]
250
+ return all_data.loc[:, self.CANDLE_PAGE_COLUMNS]
File without changes