pybinbot 2.1.13__tar.gz → 2.1.15__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 (91) hide show
  1. {pybinbot-2.1.13/pybinbot.egg-info → pybinbot-2.1.15}/PKG-INFO +1 -1
  2. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/__init__.py +3 -0
  3. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/binbot/base.py +34 -0
  4. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/bot_base.py +9 -3
  5. pybinbot-2.1.15/pybinbot/models/futures_market.py +21 -0
  6. {pybinbot-2.1.13 → pybinbot-2.1.15/pybinbot.egg-info}/PKG-INFO +1 -1
  7. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot.egg-info/SOURCES.txt +2 -0
  8. {pybinbot-2.1.13 → pybinbot-2.1.15}/pyproject.toml +1 -1
  9. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_binbot_api.py +40 -0
  10. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_conditional_entry.py +4 -2
  11. pybinbot-2.1.15/tests/test_futures_market_api.py +61 -0
  12. {pybinbot-2.1.13 → pybinbot-2.1.15}/LICENSE +0 -0
  13. {pybinbot-2.1.13 → pybinbot-2.1.15}/MANIFEST.in +0 -0
  14. {pybinbot-2.1.13 → pybinbot-2.1.15}/README.md +0 -0
  15. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/binance/base.py +0 -0
  16. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/binance/exceptions.py +0 -0
  17. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/binbot/exceptions.py +0 -0
  18. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/coingecko.py +0 -0
  19. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/base.py +0 -0
  20. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/exceptions.py +0 -0
  21. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/futures.py +0 -0
  22. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/market.py +0 -0
  23. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/orders.py +0 -0
  24. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/apis/kucoin/rest.py +0 -0
  25. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/__init__.py +0 -0
  26. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/autotrade_settings.py +0 -0
  27. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/bot.py +0 -0
  28. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/cvd.py +0 -0
  29. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/deal.py +0 -0
  30. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/derivatives.py +0 -0
  31. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/fastest_movers.py +0 -0
  32. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/grid_ladder.py +0 -0
  33. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/order.py +0 -0
  34. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/routes.py +0 -0
  35. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/signals.py +0 -0
  36. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/models/symbol.py +0 -0
  37. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/py.typed +0 -0
  38. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/__init__.py +0 -0
  39. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/beta.py +0 -0
  40. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/breadth.py +0 -0
  41. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/cache.py +0 -0
  42. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/candles.py +0 -0
  43. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/enums.py +0 -0
  44. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/handlers.py +0 -0
  45. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/heikin_ashi.py +0 -0
  46. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/indicators.py +0 -0
  47. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/logging_config.py +0 -0
  48. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/maths.py +0 -0
  49. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/price_crossings.py +0 -0
  50. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/telegram_delivery.py +0 -0
  51. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/timestamps.py +0 -0
  52. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/types.py +0 -0
  53. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/shared/utils.py +0 -0
  54. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/strategy/beta.py +0 -0
  55. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/strategy/breadth.py +0 -0
  56. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/strategy/price_crossings.py +0 -0
  57. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/strategy/swing_protection.py +0 -0
  58. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/streaming/binance/async_socket_client.py +0 -0
  59. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/streaming/binance/socket_client.py +0 -0
  60. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/streaming/binance/socket_manager.py +0 -0
  61. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot/streaming/kucoin/kucoin_async_client.py +0 -0
  62. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot.egg-info/dependency_links.txt +0 -0
  63. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot.egg-info/requires.txt +0 -0
  64. {pybinbot-2.1.13 → pybinbot-2.1.15}/pybinbot.egg-info/top_level.txt +0 -0
  65. {pybinbot-2.1.13 → pybinbot-2.1.15}/setup.cfg +0 -0
  66. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_beta.py +0 -0
  67. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_bot_futures_leverage.py +0 -0
  68. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_breadth.py +0 -0
  69. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_candles.py +0 -0
  70. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_closed_bot_status.py +0 -0
  71. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_coingecko.py +0 -0
  72. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_conditional_futures_orders.py +0 -0
  73. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_cvd_api.py +0 -0
  74. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_deal_model.py +0 -0
  75. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_derivatives_api.py +0 -0
  76. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_fastest_movers.py +0 -0
  77. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_futures_place_order.py +0 -0
  78. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_grid_ladder.py +0 -0
  79. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_handlers.py +0 -0
  80. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_heikin_ashi.py +0 -0
  81. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_indicators.py +0 -0
  82. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_kucoin_api.py +0 -0
  83. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_logging_config.py +0 -0
  84. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_matching_engine.py +0 -0
  85. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_maths.py +0 -0
  86. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_price_crossings.py +0 -0
  87. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_swing_protection.py +0 -0
  88. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_symbol_model.py +0 -0
  89. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_telegram_delivery.py +0 -0
  90. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_timestamps.py +0 -0
  91. {pybinbot-2.1.13 → pybinbot-2.1.15}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybinbot
3
- Version: 2.1.13
3
+ Version: 2.1.15
4
4
  Summary: Utility functions for the binbot project.
5
5
  Author-email: Carlos Wu <carkodw@gmail.com>
6
6
  Requires-Python: >=3.15
@@ -121,6 +121,7 @@ from pybinbot.models.signals import (
121
121
  )
122
122
  from pybinbot.models.symbol import SymbolModel
123
123
  from pybinbot.models.cvd import CvdAggregateResponse, CvdPoint, CvdSymbolResponse
124
+ from pybinbot.models.futures_market import FuturesMarketSnapshot, MarketObservation
124
125
  from pybinbot.models.fastest_movers import (
125
126
  FastestMoverEntry,
126
127
  FastestMoversResponse,
@@ -224,6 +225,8 @@ __all__ = [
224
225
  "CvdPoint",
225
226
  "CvdAggregateResponse",
226
227
  "CvdSymbolResponse",
228
+ "FuturesMarketSnapshot",
229
+ "MarketObservation",
227
230
  "AutotradeSettings",
228
231
  "AutotradeSettingsResponse",
229
232
  "AutotradeSettingsSchema",
@@ -30,6 +30,7 @@ from datetime import datetime, timezone
30
30
  from dateutil.parser import parse
31
31
  from pybinbot.models.cvd import CvdAggregateResponse, CvdSymbolResponse
32
32
  from pybinbot.models.fastest_movers import FastestMoversResponse, FastestMoversSnapshot
33
+ from pybinbot.models.futures_market import FuturesMarketSnapshot
33
34
 
34
35
  logger = logging.getLogger(__name__)
35
36
 
@@ -78,6 +79,7 @@ class BinbotApi:
78
79
  self.bb_timeseries_url = f"{bb_base_url}/charts/timeseries"
79
80
  self.bb_market_breadth_url = f"{bb_base_url}/charts/market-breadth"
80
81
  self.bb_cvd_symbol_url = f"{bb_base_url}/charts/cvd-symbol"
82
+ self.bb_futures_market_url = f"{bb_base_url}/charts/futures-market"
81
83
  self.bb_cvd_aggregate_url = f"{bb_base_url}/charts/cvd-aggregate"
82
84
  self.bb_gainers_losers_series_url = (
83
85
  f"{bb_base_url}/charts/gainers-losers-series"
@@ -284,6 +286,24 @@ class BinbotApi:
284
286
  response = self.request(url=f"{self.bb_bot_url}/symbol/{symbol}")
285
287
  return self._bot_model(response["data"])
286
288
 
289
+ def get_bot(self, bot_id: str) -> BotModel:
290
+ response = self.request(url=f"{self.bb_bot_url}/{bot_id}")
291
+ return BotModel.model_validate(response["data"])
292
+
293
+ def get_futures_market(self, symbol: str) -> FuturesMarketSnapshot:
294
+ """Read live contract, book, trades and candles for one futures symbol.
295
+
296
+ The endpoint returns a bare snapshot, not a StandardResponse envelope.
297
+ Each source carries its own fetch time or error. Assembling every
298
+ source can take tens of seconds, hence the longer read timeout.
299
+ """
300
+ response = self.request(
301
+ url=self.bb_futures_market_url,
302
+ params={"symbol": symbol.upper()},
303
+ timeout=(5, 90),
304
+ )
305
+ return FuturesMarketSnapshot.model_validate(response)
306
+
287
307
  async def get_market_breadth(self, size: int = 400) -> MarketBreadthSeries | None:
288
308
  """
289
309
  Get market breadth data
@@ -546,6 +566,20 @@ class BinbotApi:
546
566
  response = self.request(url=self.bb_bot_url, method="POST", json=data)
547
567
  return BotResponse.model_validate(response)
548
568
 
569
+ def edit_bot(self, bot_id: str, data: dict) -> BotResponse:
570
+ """Save bot fields with PUT /bot/{id}.
571
+
572
+ This only stores the bot. For an active bot, the new parameters reach
573
+ the exchange after activate_bot recalculates its protection, which is
574
+ the terminal's "Update deal" flow. Binbot rejects invalid edits with
575
+ HTTP 422, raised here as BinbotErrors. activate_bot can instead fail
576
+ with HTTP 200 and error=1, so callers must check BotResponse.error.
577
+ """
578
+ response = self.request(
579
+ url=f"{self.bb_bot_url}/{bot_id}", method="PUT", json=data
580
+ )
581
+ return BotResponse.model_validate(response)
582
+
549
583
  def activate_bot(self, bot_id: str) -> BotResponse:
550
584
  response = self.request(
551
585
  url=f"{self.bb_activate_bot_url}/{bot_id}", method="POST"
@@ -15,6 +15,8 @@ from pybinbot.shared.enums import (
15
15
  from pybinbot.shared.timestamps import timestamp, ts_to_humandate
16
16
  from pybinbot.shared.types import Amount
17
17
 
18
+ DEFAULT_ENTRY_EXPIRY_MS = 15 * 60 * 1000
19
+
18
20
 
19
21
  class RecoveryParams(BaseModel):
20
22
  reversal_path: Literal["source", "recovery"] = "source"
@@ -50,10 +52,10 @@ class BotBase(BaseModel):
50
52
  entry_mode: EntryMode = Field(default=EntryMode.immediate, validate_default=True)
51
53
  entry_price: float | None = Field(default=None, ge=0, allow_inf_nan=False)
52
54
  entry_expires_at: float = Field(
53
- default_factory=lambda data: data["created_at"] + 6 * 60 * 60 * 1000,
55
+ default_factory=lambda data: data["created_at"] + DEFAULT_ENTRY_EXPIRY_MS,
54
56
  gt=0,
55
57
  allow_inf_nan=False,
56
- description="Absolute entry deadline in Unix milliseconds; defaults to creation + 6 hours",
58
+ description="Absolute entry deadline in Unix milliseconds; defaults to creation + 15 minutes",
57
59
  )
58
60
  dynamic_trailing: bool = Field(default=False)
59
61
  dynamic_position_sizing: bool = Field(default=False)
@@ -121,7 +123,11 @@ class BotBase(BaseModel):
121
123
  @field_validator("entry_expires_at", mode="before")
122
124
  @classmethod
123
125
  def default_entry_expiry(cls, value, info: ValidationInfo):
124
- return info.data["created_at"] + 6 * 60 * 60 * 1000 if value is None else value
126
+ return (
127
+ info.data["created_at"] + DEFAULT_ENTRY_EXPIRY_MS
128
+ if value is None
129
+ else value
130
+ )
125
131
 
126
132
  @model_validator(mode="after")
127
133
  def validate_conditional_entry(self):
@@ -0,0 +1,21 @@
1
+ """Live KuCoin futures market snapshot returned by binbot's charts endpoint."""
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel
6
+
7
+
8
+ class MarketObservation(BaseModel):
9
+ """One market source, with either its data or the reason it is missing."""
10
+
11
+ observed_at: float
12
+ data: Any = None
13
+ error: str | None = None
14
+
15
+
16
+ class FuturesMarketSnapshot(BaseModel):
17
+ """Contract, book, trades and candles for one symbol, keyed by source name."""
18
+
19
+ symbol: str
20
+ captured_at: float
21
+ sources: dict[str, MarketObservation]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybinbot
3
- Version: 2.1.13
3
+ Version: 2.1.15
4
4
  Summary: Utility functions for the binbot project.
5
5
  Author-email: Carlos Wu <carkodw@gmail.com>
6
6
  Requires-Python: >=3.15
@@ -28,6 +28,7 @@ pybinbot/models/cvd.py
28
28
  pybinbot/models/deal.py
29
29
  pybinbot/models/derivatives.py
30
30
  pybinbot/models/fastest_movers.py
31
+ pybinbot/models/futures_market.py
31
32
  pybinbot/models/grid_ladder.py
32
33
  pybinbot/models/order.py
33
34
  pybinbot/models/routes.py
@@ -70,6 +71,7 @@ tests/test_cvd_api.py
70
71
  tests/test_deal_model.py
71
72
  tests/test_derivatives_api.py
72
73
  tests/test_fastest_movers.py
74
+ tests/test_futures_market_api.py
73
75
  tests/test_futures_place_order.py
74
76
  tests/test_grid_ladder.py
75
77
  tests/test_handlers.py
@@ -23,7 +23,7 @@ build-backend = "setuptools.build_meta"
23
23
 
24
24
  [project]
25
25
  name = "pybinbot"
26
- version = "2.1.13"
26
+ version = "2.1.15"
27
27
  description = "Utility functions for the binbot project."
28
28
  authors = [
29
29
  { name="Carlos Wu", email="carkodw@gmail.com" }
@@ -528,6 +528,46 @@ class TestBotRouteResponses:
528
528
  assert captured["method"] == "DELETE"
529
529
  assert captured["json"] == {"ids": ["bot-1", "bot-2"]}
530
530
 
531
+ def test_get_bot_reads_one_bot_by_id(self) -> None:
532
+ api_class = load_binbot_api_class()
533
+ api = object.__new__(api_class)
534
+ api.bb_bot_url = "https://example.com/bot"
535
+ captured: dict = {}
536
+
537
+ def fake_request(**kwargs):
538
+ captured.update(kwargs)
539
+ return {"message": "Successfully found one bot.", "data": {"pair": "X"}}
540
+
541
+ api.request = fake_request
542
+
543
+ result = api.get_bot("bot-1")
544
+
545
+ assert isinstance(result, _BotModel)
546
+ assert result.pair == "X"
547
+ assert captured == {"url": "https://example.com/bot/bot-1"}
548
+
549
+ def test_edit_bot_puts_the_full_payload_to_the_bot_url(self) -> None:
550
+ api_class = load_binbot_api_class()
551
+ api = object.__new__(api_class)
552
+ api.bb_bot_url = "https://example.com/bot"
553
+ captured: dict = {}
554
+
555
+ def fake_request(**kwargs):
556
+ captured.update(kwargs)
557
+ return {"message": "Successfully edited bot.", "data": {"pair": "X"}}
558
+
559
+ api.request = fake_request
560
+ payload = {"pair": "X", "stop_loss": 2.5, "trailing_deviation": 1.5}
561
+
562
+ result = api.edit_bot("bot-1", payload)
563
+
564
+ assert isinstance(result, _BotResponse)
565
+ assert result.message == "Successfully edited bot."
566
+ assert result.error == 0
567
+ assert captured["url"] == "https://example.com/bot/bot-1"
568
+ assert captured["method"] == "PUT"
569
+ assert captured["json"] == payload
570
+
531
571
 
532
572
  class TestCalculateGridLevels:
533
573
  def test_posts_payload_to_grid_calculate_endpoint(self) -> None:
@@ -8,10 +8,12 @@ from pybinbot import BotBase, EntryMode, MarketType
8
8
  "overrides",
9
9
  [{}, {"entry_mode": None, "entry_expires_at": None, "entry_price": None}],
10
10
  )
11
- def test_omitted_or_null_entry_fields_default_to_immediate_and_six_hours(overrides):
11
+ def test_omitted_or_null_entry_fields_default_to_immediate_and_fifteen_minutes(
12
+ overrides,
13
+ ):
12
14
  bot = BotBase(pair="XBTUSDTM", created_at=1000, **overrides)
13
15
  assert bot.entry_mode == EntryMode.immediate
14
- assert bot.entry_expires_at == 21_601_000
16
+ assert bot.entry_expires_at == 901_000
15
17
  assert bot.entry_price is None
16
18
  assert bot.model_dump(mode="json")["entry_price"] is None
17
19
 
@@ -0,0 +1,61 @@
1
+ from unittest.mock import Mock, patch
2
+
3
+ import pytest
4
+ from pydantic import ValidationError
5
+
6
+ from pybinbot import BinbotApi, FuturesMarketSnapshot, MarketObservation
7
+
8
+
9
+ def snapshot_payload() -> dict:
10
+ return {
11
+ "symbol": "XBTUSDTM",
12
+ "captured_at": 1_796_000_000.5,
13
+ "sources": {
14
+ "contract": {
15
+ "observed_at": 1_796_000_000.1,
16
+ "data": {"symbol": "XBTUSDTM", "multiplier": 0.001},
17
+ },
18
+ "trades": {"observed_at": 1_796_000_000.2, "error": "Timeout"},
19
+ },
20
+ }
21
+
22
+
23
+ @pytest.fixture
24
+ def api() -> BinbotApi:
25
+ with patch.object(BinbotApi, "_login_service_account"):
26
+ return BinbotApi("https://example.com", "service@example.com", "password")
27
+
28
+
29
+ def test_futures_market_reads_bare_snapshot_with_a_long_timeout(api, monkeypatch):
30
+ request = Mock(return_value=snapshot_payload())
31
+ monkeypatch.setattr(api, "request", request)
32
+
33
+ result = api.get_futures_market("xbtusdtm")
34
+
35
+ request.assert_called_once_with(
36
+ url="https://example.com/charts/futures-market",
37
+ params={"symbol": "XBTUSDTM"},
38
+ timeout=(5, 90),
39
+ )
40
+ assert isinstance(result, FuturesMarketSnapshot)
41
+ assert result.symbol == "XBTUSDTM"
42
+ assert isinstance(result.sources["contract"], MarketObservation)
43
+ assert result.sources["contract"].data["multiplier"] == 0.001
44
+
45
+
46
+ def test_futures_market_keeps_a_failed_source_as_an_explicit_error(api, monkeypatch):
47
+ monkeypatch.setattr(api, "request", Mock(return_value=snapshot_payload()))
48
+
49
+ trades = api.get_futures_market("XBTUSDTM").sources["trades"]
50
+
51
+ assert trades.data is None
52
+ assert trades.error == "Timeout"
53
+
54
+
55
+ def test_futures_market_rejects_a_snapshot_without_sources(api, monkeypatch):
56
+ payload = snapshot_payload()
57
+ del payload["sources"]
58
+ monkeypatch.setattr(api, "request", Mock(return_value=payload))
59
+
60
+ with pytest.raises(ValidationError):
61
+ api.get_futures_market("XBTUSDTM")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes