pybinbot 0.4.4__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.
- pybinbot-0.4.4/LICENSE +18 -0
- pybinbot-0.4.4/MANIFEST.in +2 -0
- pybinbot-0.4.4/PKG-INFO +77 -0
- pybinbot-0.4.4/README.md +51 -0
- pybinbot-0.4.4/pybinbot/__init__.py +161 -0
- pybinbot-0.4.4/pybinbot/apis/binance/base.py +586 -0
- pybinbot-0.4.4/pybinbot/apis/binance/exceptions.py +17 -0
- pybinbot-0.4.4/pybinbot/apis/binbot/base.py +327 -0
- pybinbot-0.4.4/pybinbot/apis/binbot/exceptions.py +56 -0
- pybinbot-0.4.4/pybinbot/apis/kucoin/base.py +278 -0
- pybinbot-0.4.4/pybinbot/apis/kucoin/exceptions.py +9 -0
- pybinbot-0.4.4/pybinbot/apis/kucoin/orders.py +659 -0
- pybinbot-0.4.4/pybinbot/apis/kucoin/rest.py +35 -0
- pybinbot-0.4.4/pybinbot/models/__init__.py +0 -0
- pybinbot-0.4.4/pybinbot/models/bot_base.py +99 -0
- pybinbot-0.4.4/pybinbot/models/deal.py +78 -0
- pybinbot-0.4.4/pybinbot/models/order.py +112 -0
- pybinbot-0.4.4/pybinbot/models/routes.py +6 -0
- pybinbot-0.4.4/pybinbot/models/signals.py +46 -0
- pybinbot-0.4.4/pybinbot/py.typed +0 -0
- pybinbot-0.4.4/pybinbot/shared/__init__.py +0 -0
- pybinbot-0.4.4/pybinbot/shared/cache.py +32 -0
- pybinbot-0.4.4/pybinbot/shared/enums.py +283 -0
- pybinbot-0.4.4/pybinbot/shared/handlers.py +89 -0
- pybinbot-0.4.4/pybinbot/shared/heikin_ashi.py +198 -0
- pybinbot-0.4.4/pybinbot/shared/indicators.py +271 -0
- pybinbot-0.4.4/pybinbot/shared/logging_config.py +40 -0
- pybinbot-0.4.4/pybinbot/shared/maths.py +123 -0
- pybinbot-0.4.4/pybinbot/shared/timestamps.py +98 -0
- pybinbot-0.4.4/pybinbot/shared/types.py +11 -0
- pybinbot-0.4.4/pybinbot.egg-info/PKG-INFO +77 -0
- pybinbot-0.4.4/pybinbot.egg-info/SOURCES.txt +40 -0
- pybinbot-0.4.4/pybinbot.egg-info/dependency_links.txt +1 -0
- pybinbot-0.4.4/pybinbot.egg-info/requires.txt +17 -0
- pybinbot-0.4.4/pybinbot.egg-info/top_level.txt +1 -0
- pybinbot-0.4.4/pyproject.toml +56 -0
- pybinbot-0.4.4/setup.cfg +4 -0
- pybinbot-0.4.4/tests/test_handlers.py +261 -0
- pybinbot-0.4.4/tests/test_heikin_ashi.py +344 -0
- pybinbot-0.4.4/tests/test_indicators.py +250 -0
- pybinbot-0.4.4/tests/test_maths.py +55 -0
- pybinbot-0.4.4/tests/test_timestamps.py +41 -0
pybinbot-0.4.4/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
SOFTWARE.
|
pybinbot-0.4.4/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pybinbot
|
|
3
|
+
Version: 0.4.4
|
|
4
|
+
Summary: Utility functions for the binbot project.
|
|
5
|
+
Author-email: Carlos Wu <carkodw@gmail.com>
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: pydantic[email]>=2.0.0
|
|
10
|
+
Requires-Dist: numpy==2.2.0
|
|
11
|
+
Requires-Dist: pandas>=2.2.3
|
|
12
|
+
Requires-Dist: pymongo==4.6.3
|
|
13
|
+
Requires-Dist: pandas-stubs>=2.3.3.251219
|
|
14
|
+
Requires-Dist: requests>=2.32.5
|
|
15
|
+
Requires-Dist: kucoin-universal-sdk>=1.3.0
|
|
16
|
+
Requires-Dist: aiohttp>=3.13.3
|
|
17
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=9.0.2; extra == "dev"
|
|
20
|
+
Requires-Dist: ruff>=0.11.12; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.19.1; extra == "dev"
|
|
22
|
+
Requires-Dist: types-requests>=2.32.4.20260107; extra == "dev"
|
|
23
|
+
Requires-Dist: httpx>=0.28.1; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-asyncio>=1.3.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# PyBinbot
|
|
28
|
+
|
|
29
|
+
Utility functions for the binbot project. Most of the code here is not runnable, there's no server or individual scripts, you simply move code to here when it's used in both binbot and binquant.
|
|
30
|
+
|
|
31
|
+
``pybinbot`` is the public API module for the distribution.
|
|
32
|
+
|
|
33
|
+
This module re-exports the internal ``shared`` and ``models`` packages and the most commonly used helpers and enums so consumers can simply::
|
|
34
|
+
|
|
35
|
+
from pybinbot import round_numbers, ExchangeId
|
|
36
|
+
|
|
37
|
+
The implementation deliberately avoids importing heavy third-party libraries at module import time.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv sync --extra dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`--extra dev` also installs development tools like ruff and mypy
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Publishing
|
|
50
|
+
|
|
51
|
+
1. Save your changes and do the usual Git flow (add, commit, don't push the changes yet).
|
|
52
|
+
2. Bump the version, choose one of these:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
make bump-patch
|
|
56
|
+
```
|
|
57
|
+
or
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
make bump-minor
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
make bump-major
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
3. Git tag the version for Github. This will read the bump version. There's a convenience command:
|
|
70
|
+
```
|
|
71
|
+
make tag
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
4. `git commit --amend`. This is to put these new changes in the previous commit so we don't dup uncessary commits. Then `git push`
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
For further commands take a look at the `Makefile` such as testing `make test`
|
pybinbot-0.4.4/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# PyBinbot
|
|
2
|
+
|
|
3
|
+
Utility functions for the binbot project. Most of the code here is not runnable, there's no server or individual scripts, you simply move code to here when it's used in both binbot and binquant.
|
|
4
|
+
|
|
5
|
+
``pybinbot`` is the public API module for the distribution.
|
|
6
|
+
|
|
7
|
+
This module re-exports the internal ``shared`` and ``models`` packages and the most commonly used helpers and enums so consumers can simply::
|
|
8
|
+
|
|
9
|
+
from pybinbot import round_numbers, ExchangeId
|
|
10
|
+
|
|
11
|
+
The implementation deliberately avoids importing heavy third-party libraries at module import time.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
uv sync --extra dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`--extra dev` also installs development tools like ruff and mypy
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Publishing
|
|
24
|
+
|
|
25
|
+
1. Save your changes and do the usual Git flow (add, commit, don't push the changes yet).
|
|
26
|
+
2. Bump the version, choose one of these:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
make bump-patch
|
|
30
|
+
```
|
|
31
|
+
or
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
make bump-minor
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
or
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
make bump-major
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. Git tag the version for Github. This will read the bump version. There's a convenience command:
|
|
44
|
+
```
|
|
45
|
+
make tag
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
4. `git commit --amend`. This is to put these new changes in the previous commit so we don't dup uncessary commits. Then `git push`
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
For further commands take a look at the `Makefile` such as testing `make test`
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"""Public API for the ``pybinbot`` distribution.
|
|
2
|
+
|
|
3
|
+
This package exposes a flat, convenient API for common types, enums and
|
|
4
|
+
models, while still allowing access to the structured subpackages via
|
|
5
|
+
``pybinbot.shared`` and ``pybinbot.models``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from pybinbot.shared.maths import (
|
|
9
|
+
format_ts,
|
|
10
|
+
interval_to_millisecs,
|
|
11
|
+
round_numbers,
|
|
12
|
+
round_numbers_ceiling,
|
|
13
|
+
round_numbers_floor,
|
|
14
|
+
supress_notation,
|
|
15
|
+
supress_trailling,
|
|
16
|
+
zero_remainder,
|
|
17
|
+
)
|
|
18
|
+
from pybinbot.shared.timestamps import (
|
|
19
|
+
ms_to_sec,
|
|
20
|
+
round_timestamp,
|
|
21
|
+
sec_to_ms,
|
|
22
|
+
timestamp,
|
|
23
|
+
timestamp_to_datetime,
|
|
24
|
+
ts_to_day,
|
|
25
|
+
ts_to_humandate,
|
|
26
|
+
)
|
|
27
|
+
from pybinbot.shared.enums import (
|
|
28
|
+
AutotradeSettingsDocument,
|
|
29
|
+
BinanceKlineIntervals,
|
|
30
|
+
BinanceOrderModel,
|
|
31
|
+
CloseConditions,
|
|
32
|
+
DealType,
|
|
33
|
+
ExchangeId,
|
|
34
|
+
KafkaTopics,
|
|
35
|
+
KucoinKlineIntervals,
|
|
36
|
+
MarketDominance,
|
|
37
|
+
OrderSide,
|
|
38
|
+
OrderStatus,
|
|
39
|
+
OrderType,
|
|
40
|
+
QuoteAssets,
|
|
41
|
+
Status,
|
|
42
|
+
Strategy,
|
|
43
|
+
TimeInForce,
|
|
44
|
+
TrendEnum,
|
|
45
|
+
UserRoles,
|
|
46
|
+
)
|
|
47
|
+
from pybinbot.shared.indicators import Indicators
|
|
48
|
+
from pybinbot.shared.heikin_ashi import HeikinAshi
|
|
49
|
+
from pybinbot.shared.logging_config import configure_logging
|
|
50
|
+
from pybinbot.shared.types import Amount
|
|
51
|
+
from pybinbot.shared.cache import cache
|
|
52
|
+
from pybinbot.shared.handlers import handle_binance_errors, aio_response_handler
|
|
53
|
+
from pybinbot.models.bot_base import BotBase
|
|
54
|
+
from pybinbot.models.deal import DealBase
|
|
55
|
+
from pybinbot.models.order import OrderBase
|
|
56
|
+
from pybinbot.models.signals import HABollinguerSpread, SignalsConsumer
|
|
57
|
+
from pybinbot.models.routes import StandardResponse
|
|
58
|
+
from pybinbot.apis.binance.base import BinanceApi
|
|
59
|
+
from pybinbot.apis.binbot.base import BinbotApi
|
|
60
|
+
from pybinbot.apis.binbot.exceptions import (
|
|
61
|
+
BinbotErrors,
|
|
62
|
+
QuantityTooLow,
|
|
63
|
+
IsolateBalanceError,
|
|
64
|
+
DealCreationError,
|
|
65
|
+
MarginShortError,
|
|
66
|
+
MarginLoanNotFound,
|
|
67
|
+
DeleteOrderError,
|
|
68
|
+
LowBalanceCleanupError,
|
|
69
|
+
SaveBotError,
|
|
70
|
+
InsufficientBalance,
|
|
71
|
+
)
|
|
72
|
+
from pybinbot.apis.kucoin.base import KucoinApi
|
|
73
|
+
from pybinbot.apis.kucoin.exceptions import KucoinErrors
|
|
74
|
+
from pybinbot.apis.binance.exceptions import (
|
|
75
|
+
BinanceErrors,
|
|
76
|
+
InvalidSymbol,
|
|
77
|
+
NotEnoughFunds,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
from . import models, shared, apis
|
|
82
|
+
|
|
83
|
+
__all__ = [
|
|
84
|
+
# subpackages
|
|
85
|
+
"shared",
|
|
86
|
+
"models",
|
|
87
|
+
"apis",
|
|
88
|
+
# models
|
|
89
|
+
"BotBase",
|
|
90
|
+
"OrderBase",
|
|
91
|
+
"DealBase",
|
|
92
|
+
"StandardResponse",
|
|
93
|
+
"HABollinguerSpread",
|
|
94
|
+
"SignalsConsumer",
|
|
95
|
+
# misc
|
|
96
|
+
"Amount",
|
|
97
|
+
"configure_logging",
|
|
98
|
+
"cache",
|
|
99
|
+
"handle_binance_errors",
|
|
100
|
+
"aio_response_handler",
|
|
101
|
+
# maths helpers
|
|
102
|
+
"supress_trailling",
|
|
103
|
+
"round_numbers",
|
|
104
|
+
"round_numbers_ceiling",
|
|
105
|
+
"round_numbers_floor",
|
|
106
|
+
"supress_notation",
|
|
107
|
+
"interval_to_millisecs",
|
|
108
|
+
"format_ts",
|
|
109
|
+
"zero_remainder",
|
|
110
|
+
# timestamp helpers
|
|
111
|
+
"timestamp",
|
|
112
|
+
"round_timestamp",
|
|
113
|
+
"ts_to_day",
|
|
114
|
+
"ms_to_sec",
|
|
115
|
+
"sec_to_ms",
|
|
116
|
+
"ts_to_humandate",
|
|
117
|
+
"timestamp_to_datetime",
|
|
118
|
+
# dataframes
|
|
119
|
+
"Indicators",
|
|
120
|
+
"HeikinAshi",
|
|
121
|
+
# enums
|
|
122
|
+
"CloseConditions",
|
|
123
|
+
"KafkaTopics",
|
|
124
|
+
"DealType",
|
|
125
|
+
"BinanceOrderModel",
|
|
126
|
+
"Status",
|
|
127
|
+
"Strategy",
|
|
128
|
+
"OrderType",
|
|
129
|
+
"TimeInForce",
|
|
130
|
+
"OrderSide",
|
|
131
|
+
"OrderStatus",
|
|
132
|
+
"TrendEnum",
|
|
133
|
+
"BinanceKlineIntervals",
|
|
134
|
+
"KucoinKlineIntervals",
|
|
135
|
+
"AutotradeSettingsDocument",
|
|
136
|
+
"UserRoles",
|
|
137
|
+
"QuoteAssets",
|
|
138
|
+
"ExchangeId",
|
|
139
|
+
"HABollinguerSpread",
|
|
140
|
+
"SignalsConsumer",
|
|
141
|
+
"MarketDominance",
|
|
142
|
+
# exchange apis
|
|
143
|
+
"BinbotApi",
|
|
144
|
+
"BinanceApi",
|
|
145
|
+
"KucoinApi",
|
|
146
|
+
"KucoinErrors",
|
|
147
|
+
# exceptions
|
|
148
|
+
"BinanceErrors",
|
|
149
|
+
"InvalidSymbol",
|
|
150
|
+
"NotEnoughFunds",
|
|
151
|
+
"BinbotErrors",
|
|
152
|
+
"QuantityTooLow",
|
|
153
|
+
"IsolateBalanceError",
|
|
154
|
+
"MarginShortError",
|
|
155
|
+
"MarginLoanNotFound",
|
|
156
|
+
"DeleteOrderError",
|
|
157
|
+
"LowBalanceCleanupError",
|
|
158
|
+
"DealCreationError",
|
|
159
|
+
"SaveBotError",
|
|
160
|
+
"InsufficientBalance",
|
|
161
|
+
]
|