rivermarkets 0.1.0__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.
- rivermarkets-0.1.0/PKG-INFO +62 -0
- rivermarkets-0.1.0/README.md +43 -0
- rivermarkets-0.1.0/pyproject.toml +33 -0
- rivermarkets-0.1.0/rivermarkets/__init__.py +144 -0
- rivermarkets-0.1.0/rivermarkets/client.py +188 -0
- rivermarkets-0.1.0/rivermarkets/complex_orders/__init__.py +5 -0
- rivermarkets-0.1.0/rivermarkets/complex_orders/client.py +863 -0
- rivermarkets-0.1.0/rivermarkets/complex_orders/types/__init__.py +7 -0
- rivermarkets-0.1.0/rivermarkets/complex_orders/types/list_complex_orders_v1complex_orders_get_request_status.py +7 -0
- rivermarkets-0.1.0/rivermarkets/core/__init__.py +47 -0
- rivermarkets-0.1.0/rivermarkets/core/api_error.py +17 -0
- rivermarkets-0.1.0/rivermarkets/core/client_wrapper.py +64 -0
- rivermarkets-0.1.0/rivermarkets/core/datetime_utils.py +30 -0
- rivermarkets-0.1.0/rivermarkets/core/file.py +65 -0
- rivermarkets-0.1.0/rivermarkets/core/http_client.py +575 -0
- rivermarkets-0.1.0/rivermarkets/core/jsonable_encoder.py +103 -0
- rivermarkets-0.1.0/rivermarkets/core/pydantic_utilities.py +323 -0
- rivermarkets-0.1.0/rivermarkets/core/query_encoder.py +60 -0
- rivermarkets-0.1.0/rivermarkets/core/remove_none_from_dict.py +11 -0
- rivermarkets-0.1.0/rivermarkets/core/request_options.py +35 -0
- rivermarkets-0.1.0/rivermarkets/core/serialization.py +276 -0
- rivermarkets-0.1.0/rivermarkets/custom_assets/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/custom_assets/client.py +977 -0
- rivermarkets-0.1.0/rivermarkets/environment.py +7 -0
- rivermarkets-0.1.0/rivermarkets/errors/__init__.py +7 -0
- rivermarkets-0.1.0/rivermarkets/errors/bad_request_error.py +9 -0
- rivermarkets-0.1.0/rivermarkets/errors/not_found_error.py +9 -0
- rivermarkets-0.1.0/rivermarkets/errors/unprocessable_entity_error.py +9 -0
- rivermarkets-0.1.0/rivermarkets/fills/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/fills/client.py +208 -0
- rivermarkets-0.1.0/rivermarkets/markets/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/markets/client.py +530 -0
- rivermarkets-0.1.0/rivermarkets/orderbooks/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/orderbooks/client.py +183 -0
- rivermarkets-0.1.0/rivermarkets/orders/__init__.py +13 -0
- rivermarkets-0.1.0/rivermarkets/orders/client.py +949 -0
- rivermarkets-0.1.0/rivermarkets/orders/types/__init__.py +11 -0
- rivermarkets-0.1.0/rivermarkets/orders/types/list_orders_v1orders_get_request_status.py +17 -0
- rivermarkets-0.1.0/rivermarkets/orders/types/order_create_order_type.py +5 -0
- rivermarkets-0.1.0/rivermarkets/orders/types/order_create_time_in_force.py +7 -0
- rivermarkets-0.1.0/rivermarkets/positions/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/positions/client.py +172 -0
- rivermarkets-0.1.0/rivermarkets/prices/__init__.py +11 -0
- rivermarkets-0.1.0/rivermarkets/prices/client.py +211 -0
- rivermarkets-0.1.0/rivermarkets/prices/types/__init__.py +13 -0
- rivermarkets-0.1.0/rivermarkets/prices/types/get_prices_v1prices_river_id_get_request_interval.py +7 -0
- rivermarkets-0.1.0/rivermarkets/prices/types/get_prices_v1prices_river_id_get_request_type.py +7 -0
- rivermarkets-0.1.0/rivermarkets/subaccounts/__init__.py +2 -0
- rivermarkets-0.1.0/rivermarkets/subaccounts/client.py +809 -0
- rivermarkets-0.1.0/rivermarkets/types/__init__.py +103 -0
- rivermarkets-0.1.0/rivermarkets/types/api_key_create.py +21 -0
- rivermarkets-0.1.0/rivermarkets/types/api_key_create_response.py +29 -0
- rivermarkets-0.1.0/rivermarkets/types/api_key_response.py +31 -0
- rivermarkets-0.1.0/rivermarkets/types/api_key_rotate_response.py +28 -0
- rivermarkets-0.1.0/rivermarkets/types/cancel_complex_order_response.py +25 -0
- rivermarkets-0.1.0/rivermarkets/types/cancel_order_response.py +25 -0
- rivermarkets-0.1.0/rivermarkets/types/complex_order_list_response.py +28 -0
- rivermarkets-0.1.0/rivermarkets/types/complex_order_response.py +69 -0
- rivermarkets-0.1.0/rivermarkets/types/conditional_order_create.py +46 -0
- rivermarkets-0.1.0/rivermarkets/types/conditional_order_create_conditional_order_type.py +7 -0
- rivermarkets-0.1.0/rivermarkets/types/conditional_order_response.py +66 -0
- rivermarkets-0.1.0/rivermarkets/types/credential_response.py +22 -0
- rivermarkets-0.1.0/rivermarkets/types/custom_asset_detail_response.py +25 -0
- rivermarkets-0.1.0/rivermarkets/types/custom_asset_response.py +23 -0
- rivermarkets-0.1.0/rivermarkets/types/encrypted_credential_create.py +27 -0
- rivermarkets-0.1.0/rivermarkets/types/fill_response.py +28 -0
- rivermarkets-0.1.0/rivermarkets/types/http_validation_error.py +14 -0
- rivermarkets-0.1.0/rivermarkets/types/invite_redeem_request.py +18 -0
- rivermarkets-0.1.0/rivermarkets/types/invite_redeem_response.py +18 -0
- rivermarkets-0.1.0/rivermarkets/types/market_lookup_response.py +18 -0
- rivermarkets-0.1.0/rivermarkets/types/market_search_response.py +20 -0
- rivermarkets-0.1.0/rivermarkets/types/market_search_result.py +35 -0
- rivermarkets-0.1.0/rivermarkets/types/order_create_response.py +25 -0
- rivermarkets-0.1.0/rivermarkets/types/order_detail_response.py +114 -0
- rivermarkets-0.1.0/rivermarkets/types/order_fill_response.py +61 -0
- rivermarkets-0.1.0/rivermarkets/types/order_list_response.py +26 -0
- rivermarkets-0.1.0/rivermarkets/types/order_response.py +106 -0
- rivermarkets-0.1.0/rivermarkets/types/orderbook_data.py +21 -0
- rivermarkets-0.1.0/rivermarkets/types/orderbook_response.py +17 -0
- rivermarkets-0.1.0/rivermarkets/types/orderbook_status.py +5 -0
- rivermarkets-0.1.0/rivermarkets/types/position_list_response.py +18 -0
- rivermarkets-0.1.0/rivermarkets/types/position_response.py +20 -0
- rivermarkets-0.1.0/rivermarkets/types/price_candlestick.py +22 -0
- rivermarkets-0.1.0/rivermarkets/types/price_level_response.py +14 -0
- rivermarkets-0.1.0/rivermarkets/types/price_point.py +18 -0
- rivermarkets-0.1.0/rivermarkets/types/price_response.py +24 -0
- rivermarkets-0.1.0/rivermarkets/types/price_response_type.py +5 -0
- rivermarkets-0.1.0/rivermarkets/types/subaccount_response.py +22 -0
- rivermarkets-0.1.0/rivermarkets/types/trigger_order.py +37 -0
- rivermarkets-0.1.0/rivermarkets/types/trigger_order_order_type.py +5 -0
- rivermarkets-0.1.0/rivermarkets/types/user_fill_list_response.py +22 -0
- rivermarkets-0.1.0/rivermarkets/types/user_fill_list_response_subaccount_to_fills_item_value.py +8 -0
- rivermarkets-0.1.0/rivermarkets/types/user_position_list_response.py +22 -0
- rivermarkets-0.1.0/rivermarkets/types/user_position_list_response_subaccount_to_positions_item_value.py +8 -0
- rivermarkets-0.1.0/rivermarkets/types/validation_error.py +16 -0
- rivermarkets-0.1.0/rivermarkets/types/validation_error_loc_item.py +5 -0
- rivermarkets-0.1.0/rivermarkets.egg-info/PKG-INFO +62 -0
- rivermarkets-0.1.0/rivermarkets.egg-info/SOURCES.txt +100 -0
- rivermarkets-0.1.0/rivermarkets.egg-info/dependency_links.txt +1 -0
- rivermarkets-0.1.0/rivermarkets.egg-info/requires.txt +3 -0
- rivermarkets-0.1.0/rivermarkets.egg-info/top_level.txt +1 -0
- rivermarkets-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rivermarkets
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the River Markets API
|
|
5
|
+
Author-email: River Markets <support@rivermarkets.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://rivermarkets.com
|
|
8
|
+
Project-URL: Documentation, https://docs.rivermarkets.com
|
|
9
|
+
Project-URL: Repository, https://github.com/rivermarkets/rivermarkets-python-sdk
|
|
10
|
+
Project-URL: Issues, https://github.com/rivermarkets/rivermarkets-python-sdk/issues
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: httpx>=0.24.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Requires-Dist: typing_extensions>=4.0
|
|
19
|
+
|
|
20
|
+
# River Markets Python SDK
|
|
21
|
+
|
|
22
|
+
Python SDK for the [River Markets API](https://docs.rivermarkets.com).
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install rivermarkets
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from rivermarkets import RiverMarkets
|
|
34
|
+
|
|
35
|
+
client = RiverMarkets(api_key="your_api_key")
|
|
36
|
+
|
|
37
|
+
# Search markets
|
|
38
|
+
results = client.markets.search_markets(q="bitcoin")
|
|
39
|
+
|
|
40
|
+
# Place an order
|
|
41
|
+
order = client.orders.create_order(
|
|
42
|
+
subaccount_id="...",
|
|
43
|
+
river_id=4552150,
|
|
44
|
+
order_type="LIMIT",
|
|
45
|
+
time_in_force="GTC",
|
|
46
|
+
buy_flag=True,
|
|
47
|
+
price=0.50,
|
|
48
|
+
qty=10,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Cancel an order
|
|
52
|
+
client.orders.cancel_order(order_id="...")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Async
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from rivermarkets import AsyncRiverMarkets
|
|
59
|
+
|
|
60
|
+
client = AsyncRiverMarkets(api_key="your_api_key")
|
|
61
|
+
results = await client.markets.search_markets(q="bitcoin")
|
|
62
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# River Markets Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for the [River Markets API](https://docs.rivermarkets.com).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install rivermarkets
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from rivermarkets import RiverMarkets
|
|
15
|
+
|
|
16
|
+
client = RiverMarkets(api_key="your_api_key")
|
|
17
|
+
|
|
18
|
+
# Search markets
|
|
19
|
+
results = client.markets.search_markets(q="bitcoin")
|
|
20
|
+
|
|
21
|
+
# Place an order
|
|
22
|
+
order = client.orders.create_order(
|
|
23
|
+
subaccount_id="...",
|
|
24
|
+
river_id=4552150,
|
|
25
|
+
order_type="LIMIT",
|
|
26
|
+
time_in_force="GTC",
|
|
27
|
+
buy_flag=True,
|
|
28
|
+
price=0.50,
|
|
29
|
+
qty=10,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Cancel an order
|
|
33
|
+
client.orders.cancel_order(order_id="...")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Async
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from rivermarkets import AsyncRiverMarkets
|
|
40
|
+
|
|
41
|
+
client = AsyncRiverMarkets(api_key="your_api_key")
|
|
42
|
+
results = await client.markets.search_markets(q="bitcoin")
|
|
43
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rivermarkets"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for the River Markets API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "River Markets", email = "support@rivermarkets.com" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"httpx>=0.24.0",
|
|
22
|
+
"pydantic>=2.0",
|
|
23
|
+
"typing_extensions>=4.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://rivermarkets.com"
|
|
28
|
+
Documentation = "https://docs.rivermarkets.com"
|
|
29
|
+
Repository = "https://github.com/rivermarkets/rivermarkets-python-sdk"
|
|
30
|
+
Issues = "https://github.com/rivermarkets/rivermarkets-python-sdk/issues"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
include = ["rivermarkets*"]
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import (
|
|
4
|
+
ApiKeyCreate,
|
|
5
|
+
ApiKeyCreateResponse,
|
|
6
|
+
ApiKeyResponse,
|
|
7
|
+
ApiKeyRotateResponse,
|
|
8
|
+
CancelComplexOrderResponse,
|
|
9
|
+
CancelOrderResponse,
|
|
10
|
+
ComplexOrderListResponse,
|
|
11
|
+
ComplexOrderResponse,
|
|
12
|
+
ConditionalOrderCreate,
|
|
13
|
+
ConditionalOrderCreateConditionalOrderType,
|
|
14
|
+
ConditionalOrderResponse,
|
|
15
|
+
CredentialResponse,
|
|
16
|
+
CustomAssetDetailResponse,
|
|
17
|
+
CustomAssetResponse,
|
|
18
|
+
EncryptedCredentialCreate,
|
|
19
|
+
FillResponse,
|
|
20
|
+
HttpValidationError,
|
|
21
|
+
InviteRedeemRequest,
|
|
22
|
+
InviteRedeemResponse,
|
|
23
|
+
MarketLookupResponse,
|
|
24
|
+
MarketSearchResponse,
|
|
25
|
+
MarketSearchResult,
|
|
26
|
+
OrderCreateResponse,
|
|
27
|
+
OrderDetailResponse,
|
|
28
|
+
OrderFillResponse,
|
|
29
|
+
OrderListResponse,
|
|
30
|
+
OrderResponse,
|
|
31
|
+
OrderbookData,
|
|
32
|
+
OrderbookResponse,
|
|
33
|
+
OrderbookStatus,
|
|
34
|
+
PositionListResponse,
|
|
35
|
+
PositionResponse,
|
|
36
|
+
PriceCandlestick,
|
|
37
|
+
PriceLevelResponse,
|
|
38
|
+
PricePoint,
|
|
39
|
+
PriceResponse,
|
|
40
|
+
PriceResponseType,
|
|
41
|
+
SubaccountResponse,
|
|
42
|
+
TriggerOrder,
|
|
43
|
+
TriggerOrderOrderType,
|
|
44
|
+
UserFillListResponse,
|
|
45
|
+
UserFillListResponseSubaccountToFillsItemValue,
|
|
46
|
+
UserPositionListResponse,
|
|
47
|
+
UserPositionListResponseSubaccountToPositionsItemValue,
|
|
48
|
+
ValidationError,
|
|
49
|
+
ValidationErrorLocItem,
|
|
50
|
+
)
|
|
51
|
+
from .errors import BadRequestError, NotFoundError, UnprocessableEntityError
|
|
52
|
+
from . import (
|
|
53
|
+
complex_orders,
|
|
54
|
+
custom_assets,
|
|
55
|
+
fills,
|
|
56
|
+
markets,
|
|
57
|
+
orderbooks,
|
|
58
|
+
orders,
|
|
59
|
+
positions,
|
|
60
|
+
prices,
|
|
61
|
+
subaccounts,
|
|
62
|
+
)
|
|
63
|
+
from .client import AsyncRiverMarkets, RiverMarkets
|
|
64
|
+
from .complex_orders import ListComplexOrdersV1ComplexOrdersGetRequestStatus
|
|
65
|
+
from .environment import RiverMarketsEnvironment
|
|
66
|
+
from .orders import (
|
|
67
|
+
ListOrdersV1OrdersGetRequestStatus,
|
|
68
|
+
OrderCreateOrderType,
|
|
69
|
+
OrderCreateTimeInForce,
|
|
70
|
+
)
|
|
71
|
+
from .prices import (
|
|
72
|
+
GetPricesV1PricesRiverIdGetRequestInterval,
|
|
73
|
+
GetPricesV1PricesRiverIdGetRequestType,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
__all__ = [
|
|
77
|
+
"ApiKeyCreate",
|
|
78
|
+
"ApiKeyCreateResponse",
|
|
79
|
+
"ApiKeyResponse",
|
|
80
|
+
"ApiKeyRotateResponse",
|
|
81
|
+
"AsyncRiverMarkets",
|
|
82
|
+
"BadRequestError",
|
|
83
|
+
"CancelComplexOrderResponse",
|
|
84
|
+
"CancelOrderResponse",
|
|
85
|
+
"ComplexOrderListResponse",
|
|
86
|
+
"ComplexOrderResponse",
|
|
87
|
+
"ConditionalOrderCreate",
|
|
88
|
+
"ConditionalOrderCreateConditionalOrderType",
|
|
89
|
+
"ConditionalOrderResponse",
|
|
90
|
+
"CredentialResponse",
|
|
91
|
+
"CustomAssetDetailResponse",
|
|
92
|
+
"CustomAssetResponse",
|
|
93
|
+
"EncryptedCredentialCreate",
|
|
94
|
+
"FillResponse",
|
|
95
|
+
"GetPricesV1PricesRiverIdGetRequestInterval",
|
|
96
|
+
"GetPricesV1PricesRiverIdGetRequestType",
|
|
97
|
+
"HttpValidationError",
|
|
98
|
+
"InviteRedeemRequest",
|
|
99
|
+
"InviteRedeemResponse",
|
|
100
|
+
"ListComplexOrdersV1ComplexOrdersGetRequestStatus",
|
|
101
|
+
"ListOrdersV1OrdersGetRequestStatus",
|
|
102
|
+
"MarketLookupResponse",
|
|
103
|
+
"MarketSearchResponse",
|
|
104
|
+
"MarketSearchResult",
|
|
105
|
+
"NotFoundError",
|
|
106
|
+
"OrderCreateOrderType",
|
|
107
|
+
"OrderCreateResponse",
|
|
108
|
+
"OrderCreateTimeInForce",
|
|
109
|
+
"OrderDetailResponse",
|
|
110
|
+
"OrderFillResponse",
|
|
111
|
+
"OrderListResponse",
|
|
112
|
+
"OrderResponse",
|
|
113
|
+
"OrderbookData",
|
|
114
|
+
"OrderbookResponse",
|
|
115
|
+
"OrderbookStatus",
|
|
116
|
+
"PositionListResponse",
|
|
117
|
+
"PositionResponse",
|
|
118
|
+
"PriceCandlestick",
|
|
119
|
+
"PriceLevelResponse",
|
|
120
|
+
"PricePoint",
|
|
121
|
+
"PriceResponse",
|
|
122
|
+
"PriceResponseType",
|
|
123
|
+
"RiverMarkets",
|
|
124
|
+
"RiverMarketsEnvironment",
|
|
125
|
+
"SubaccountResponse",
|
|
126
|
+
"TriggerOrder",
|
|
127
|
+
"TriggerOrderOrderType",
|
|
128
|
+
"UnprocessableEntityError",
|
|
129
|
+
"UserFillListResponse",
|
|
130
|
+
"UserFillListResponseSubaccountToFillsItemValue",
|
|
131
|
+
"UserPositionListResponse",
|
|
132
|
+
"UserPositionListResponseSubaccountToPositionsItemValue",
|
|
133
|
+
"ValidationError",
|
|
134
|
+
"ValidationErrorLocItem",
|
|
135
|
+
"complex_orders",
|
|
136
|
+
"custom_assets",
|
|
137
|
+
"fills",
|
|
138
|
+
"markets",
|
|
139
|
+
"orderbooks",
|
|
140
|
+
"orders",
|
|
141
|
+
"positions",
|
|
142
|
+
"prices",
|
|
143
|
+
"subaccounts",
|
|
144
|
+
]
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .environment import RiverMarketsEnvironment
|
|
5
|
+
import httpx
|
|
6
|
+
from .core.client_wrapper import SyncClientWrapper
|
|
7
|
+
from .complex_orders.client import ComplexOrdersClient
|
|
8
|
+
from .custom_assets.client import CustomAssetsClient
|
|
9
|
+
from .fills.client import FillsClient
|
|
10
|
+
from .markets.client import MarketsClient
|
|
11
|
+
from .orderbooks.client import OrderbooksClient
|
|
12
|
+
from .orders.client import OrdersClient
|
|
13
|
+
from .positions.client import PositionsClient
|
|
14
|
+
from .prices.client import PricesClient
|
|
15
|
+
from .subaccounts.client import SubaccountsClient
|
|
16
|
+
from .core.client_wrapper import AsyncClientWrapper
|
|
17
|
+
from .complex_orders.client import AsyncComplexOrdersClient
|
|
18
|
+
from .custom_assets.client import AsyncCustomAssetsClient
|
|
19
|
+
from .fills.client import AsyncFillsClient
|
|
20
|
+
from .markets.client import AsyncMarketsClient
|
|
21
|
+
from .orderbooks.client import AsyncOrderbooksClient
|
|
22
|
+
from .orders.client import AsyncOrdersClient
|
|
23
|
+
from .positions.client import AsyncPositionsClient
|
|
24
|
+
from .prices.client import AsyncPricesClient
|
|
25
|
+
from .subaccounts.client import AsyncSubaccountsClient
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RiverMarkets:
|
|
29
|
+
"""
|
|
30
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
base_url : typing.Optional[str]
|
|
35
|
+
The base url to use for requests from the client.
|
|
36
|
+
|
|
37
|
+
environment : RiverMarketsEnvironment
|
|
38
|
+
The environment to use for requests from the client. from .environment import RiverMarketsEnvironment
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Defaults to RiverMarketsEnvironment.DEFAULT
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
api_key : str
|
|
47
|
+
timeout : typing.Optional[float]
|
|
48
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
49
|
+
|
|
50
|
+
follow_redirects : typing.Optional[bool]
|
|
51
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
52
|
+
|
|
53
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
54
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
55
|
+
|
|
56
|
+
Examples
|
|
57
|
+
--------
|
|
58
|
+
from rivermarkets import RiverMarkets
|
|
59
|
+
|
|
60
|
+
client = RiverMarkets(
|
|
61
|
+
api_key="YOUR_API_KEY",
|
|
62
|
+
)
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
*,
|
|
68
|
+
base_url: typing.Optional[str] = None,
|
|
69
|
+
environment: RiverMarketsEnvironment = RiverMarketsEnvironment.DEFAULT,
|
|
70
|
+
api_key: str,
|
|
71
|
+
timeout: typing.Optional[float] = None,
|
|
72
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
73
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
74
|
+
):
|
|
75
|
+
_defaulted_timeout = (
|
|
76
|
+
timeout if timeout is not None else 60 if httpx_client is None else None
|
|
77
|
+
)
|
|
78
|
+
self._client_wrapper = SyncClientWrapper(
|
|
79
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
80
|
+
api_key=api_key,
|
|
81
|
+
httpx_client=httpx_client
|
|
82
|
+
if httpx_client is not None
|
|
83
|
+
else httpx.Client(
|
|
84
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
85
|
+
)
|
|
86
|
+
if follow_redirects is not None
|
|
87
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
88
|
+
timeout=_defaulted_timeout,
|
|
89
|
+
)
|
|
90
|
+
self.complex_orders = ComplexOrdersClient(client_wrapper=self._client_wrapper)
|
|
91
|
+
self.custom_assets = CustomAssetsClient(client_wrapper=self._client_wrapper)
|
|
92
|
+
self.fills = FillsClient(client_wrapper=self._client_wrapper)
|
|
93
|
+
self.markets = MarketsClient(client_wrapper=self._client_wrapper)
|
|
94
|
+
self.orderbooks = OrderbooksClient(client_wrapper=self._client_wrapper)
|
|
95
|
+
self.orders = OrdersClient(client_wrapper=self._client_wrapper)
|
|
96
|
+
self.positions = PositionsClient(client_wrapper=self._client_wrapper)
|
|
97
|
+
self.prices = PricesClient(client_wrapper=self._client_wrapper)
|
|
98
|
+
self.subaccounts = SubaccountsClient(client_wrapper=self._client_wrapper)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class AsyncRiverMarkets:
|
|
102
|
+
"""
|
|
103
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
base_url : typing.Optional[str]
|
|
108
|
+
The base url to use for requests from the client.
|
|
109
|
+
|
|
110
|
+
environment : RiverMarketsEnvironment
|
|
111
|
+
The environment to use for requests from the client. from .environment import RiverMarketsEnvironment
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
Defaults to RiverMarketsEnvironment.DEFAULT
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
api_key : str
|
|
120
|
+
timeout : typing.Optional[float]
|
|
121
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
122
|
+
|
|
123
|
+
follow_redirects : typing.Optional[bool]
|
|
124
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
125
|
+
|
|
126
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
127
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
128
|
+
|
|
129
|
+
Examples
|
|
130
|
+
--------
|
|
131
|
+
from rivermarkets import AsyncRiverMarkets
|
|
132
|
+
|
|
133
|
+
client = AsyncRiverMarkets(
|
|
134
|
+
api_key="YOUR_API_KEY",
|
|
135
|
+
)
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
def __init__(
|
|
139
|
+
self,
|
|
140
|
+
*,
|
|
141
|
+
base_url: typing.Optional[str] = None,
|
|
142
|
+
environment: RiverMarketsEnvironment = RiverMarketsEnvironment.DEFAULT,
|
|
143
|
+
api_key: str,
|
|
144
|
+
timeout: typing.Optional[float] = None,
|
|
145
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
146
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
147
|
+
):
|
|
148
|
+
_defaulted_timeout = (
|
|
149
|
+
timeout if timeout is not None else 60 if httpx_client is None else None
|
|
150
|
+
)
|
|
151
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
152
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
153
|
+
api_key=api_key,
|
|
154
|
+
httpx_client=httpx_client
|
|
155
|
+
if httpx_client is not None
|
|
156
|
+
else httpx.AsyncClient(
|
|
157
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
158
|
+
)
|
|
159
|
+
if follow_redirects is not None
|
|
160
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
161
|
+
timeout=_defaulted_timeout,
|
|
162
|
+
)
|
|
163
|
+
self.complex_orders = AsyncComplexOrdersClient(
|
|
164
|
+
client_wrapper=self._client_wrapper
|
|
165
|
+
)
|
|
166
|
+
self.custom_assets = AsyncCustomAssetsClient(
|
|
167
|
+
client_wrapper=self._client_wrapper
|
|
168
|
+
)
|
|
169
|
+
self.fills = AsyncFillsClient(client_wrapper=self._client_wrapper)
|
|
170
|
+
self.markets = AsyncMarketsClient(client_wrapper=self._client_wrapper)
|
|
171
|
+
self.orderbooks = AsyncOrderbooksClient(client_wrapper=self._client_wrapper)
|
|
172
|
+
self.orders = AsyncOrdersClient(client_wrapper=self._client_wrapper)
|
|
173
|
+
self.positions = AsyncPositionsClient(client_wrapper=self._client_wrapper)
|
|
174
|
+
self.prices = AsyncPricesClient(client_wrapper=self._client_wrapper)
|
|
175
|
+
self.subaccounts = AsyncSubaccountsClient(client_wrapper=self._client_wrapper)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _get_base_url(
|
|
179
|
+
*, base_url: typing.Optional[str] = None, environment: RiverMarketsEnvironment
|
|
180
|
+
) -> str:
|
|
181
|
+
if base_url is not None:
|
|
182
|
+
return base_url
|
|
183
|
+
elif environment is not None:
|
|
184
|
+
return environment.value
|
|
185
|
+
else:
|
|
186
|
+
raise Exception(
|
|
187
|
+
"Please pass in either base_url or environment to construct the client"
|
|
188
|
+
)
|