finterion-investing-algorithm-framework 0.11.1__py3-none-any.whl → 0.11.2__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.
Potentially problematic release.
This version of finterion-investing-algorithm-framework might be problematic. Click here for more details.
- finterion_investing_algorithm_framework/create_app.py +13 -3
- finterion_investing_algorithm_framework/market_service.py +26 -17
- finterion_investing_algorithm_framework/models/portfolio_configuration.py +1 -5
- {finterion_investing_algorithm_framework-0.11.1.dist-info → finterion_investing_algorithm_framework-0.11.2.dist-info}/METADATA +2 -2
- {finterion_investing_algorithm_framework-0.11.1.dist-info → finterion_investing_algorithm_framework-0.11.2.dist-info}/RECORD +8 -8
- {finterion_investing_algorithm_framework-0.11.1.dist-info → finterion_investing_algorithm_framework-0.11.2.dist-info}/LICENSE +0 -0
- {finterion_investing_algorithm_framework-0.11.1.dist-info → finterion_investing_algorithm_framework-0.11.2.dist-info}/WHEEL +0 -0
- {finterion_investing_algorithm_framework-0.11.1.dist-info → finterion_investing_algorithm_framework-0.11.2.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
|
|
3
3
|
from finterion import Finterion
|
|
4
4
|
from investing_algorithm_framework import create_app as framework_create_app, \
|
|
5
|
-
Task, TimeUnit, App
|
|
5
|
+
Task, TimeUnit, App, MarketCredential
|
|
6
6
|
|
|
7
7
|
from finterion_investing_algorithm_framework.market_service import \
|
|
8
8
|
FinterionMarketService
|
|
@@ -23,13 +23,23 @@ def create_app(
|
|
|
23
23
|
client.ping()
|
|
24
24
|
model = client.get_algorithm_model()
|
|
25
25
|
portfolio_configuration = FinterionPortfolioConfiguration(
|
|
26
|
-
api_key=api_key,
|
|
27
26
|
trading_symbol=model['profile']['trading_symbol'],
|
|
28
27
|
market_data_markets=model['profile']['markets'],
|
|
29
28
|
)
|
|
30
29
|
app = framework_create_app(config=config, web=web, stateless=stateless)
|
|
30
|
+
app.add_market_credential(
|
|
31
|
+
MarketCredential(
|
|
32
|
+
market="finterion",
|
|
33
|
+
api_key=api_key,
|
|
34
|
+
secret_key=None,
|
|
35
|
+
)
|
|
36
|
+
)
|
|
31
37
|
app.container.market_service.override(
|
|
32
|
-
FinterionMarketService(
|
|
38
|
+
FinterionMarketService(
|
|
39
|
+
api_key=api_key,
|
|
40
|
+
base_url=base_url,
|
|
41
|
+
market_credential_service=app.container.market_credential_service,
|
|
42
|
+
)
|
|
33
43
|
)
|
|
34
44
|
app.add_portfolio_configuration(portfolio_configuration)
|
|
35
45
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from decimal import Decimal
|
|
3
2
|
|
|
4
3
|
from dateutil import parser
|
|
5
4
|
from finterion import Finterion
|
|
@@ -10,18 +9,27 @@ from investing_algorithm_framework.infrastructure import CCXTMarketService
|
|
|
10
9
|
|
|
11
10
|
class FinterionMarketService(CCXTMarketService):
|
|
12
11
|
|
|
13
|
-
def cancel_order(self, order):
|
|
12
|
+
def cancel_order(self, order, market):
|
|
14
13
|
pass
|
|
15
14
|
|
|
16
|
-
def get_open_orders(
|
|
17
|
-
|
|
15
|
+
def get_open_orders(
|
|
16
|
+
self, market, target_symbol: str = None, trading_symbol: str = None
|
|
17
|
+
):
|
|
18
18
|
pass
|
|
19
19
|
|
|
20
|
-
def get_closed_orders(
|
|
21
|
-
|
|
20
|
+
def get_closed_orders(
|
|
21
|
+
self, market, target_symbol: str = None, trading_symbol: str = None
|
|
22
|
+
):
|
|
22
23
|
pass
|
|
23
24
|
|
|
24
|
-
def __init__(
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
api_key,
|
|
28
|
+
market_credential_service,
|
|
29
|
+
base_url=None,
|
|
30
|
+
initialize=True
|
|
31
|
+
):
|
|
32
|
+
super().__init__(market_credential_service)
|
|
25
33
|
self._api_key = api_key
|
|
26
34
|
self._market = "finterion"
|
|
27
35
|
|
|
@@ -34,23 +42,23 @@ class FinterionMarketService(CCXTMarketService):
|
|
|
34
42
|
def initialize(self, portfolio_configuration):
|
|
35
43
|
pass
|
|
36
44
|
|
|
37
|
-
def get_order(self, order):
|
|
38
|
-
order = self._finterion.get_order(order.
|
|
45
|
+
def get_order(self, order, market):
|
|
46
|
+
order = self._finterion.get_order(order.get_external_id())
|
|
39
47
|
return self._convert_order(order)
|
|
40
48
|
|
|
41
|
-
def get_orders(self, symbol, since: datetime = None):
|
|
49
|
+
def get_orders(self, symbol, market, since: datetime = None):
|
|
42
50
|
orders = self._finterion.get_orders(target_symbol=symbol)
|
|
43
51
|
return [self._convert_order(order) for order in orders]
|
|
44
52
|
|
|
45
|
-
def get_balance(self):
|
|
53
|
+
def get_balance(self, market):
|
|
46
54
|
positions = self._finterion.get_positions()
|
|
47
55
|
entries = {"free": {}}
|
|
48
56
|
|
|
49
57
|
for position in positions:
|
|
50
58
|
entries[position["symbol"]] = {
|
|
51
|
-
"free":
|
|
59
|
+
"free": position["amount"],
|
|
52
60
|
}
|
|
53
|
-
entries["free"][position["symbol"]] =
|
|
61
|
+
entries["free"][position["symbol"]] = float(position["amount"])
|
|
54
62
|
|
|
55
63
|
return entries
|
|
56
64
|
|
|
@@ -59,6 +67,7 @@ class FinterionMarketService(CCXTMarketService):
|
|
|
59
67
|
target_symbol: str,
|
|
60
68
|
trading_symbol: str,
|
|
61
69
|
amount: float,
|
|
70
|
+
market
|
|
62
71
|
):
|
|
63
72
|
order = self._finterion.create_market_order(
|
|
64
73
|
order_side="sell",
|
|
@@ -72,7 +81,8 @@ class FinterionMarketService(CCXTMarketService):
|
|
|
72
81
|
target_symbol: str,
|
|
73
82
|
trading_symbol: str,
|
|
74
83
|
amount,
|
|
75
|
-
price
|
|
84
|
+
price,
|
|
85
|
+
market
|
|
76
86
|
):
|
|
77
87
|
order = self._finterion.create_limit_order(
|
|
78
88
|
order_side="sell",
|
|
@@ -87,7 +97,8 @@ class FinterionMarketService(CCXTMarketService):
|
|
|
87
97
|
target_symbol: str,
|
|
88
98
|
trading_symbol: str,
|
|
89
99
|
amount: float,
|
|
90
|
-
price: float
|
|
100
|
+
price: float,
|
|
101
|
+
market
|
|
91
102
|
):
|
|
92
103
|
order = self._finterion.create_limit_order(
|
|
93
104
|
order_side="buy",
|
|
@@ -125,5 +136,3 @@ class FinterionMarketService(CCXTMarketService):
|
|
|
125
136
|
order.updated_at = parser.parse(finterion_order.get("updated_at"))
|
|
126
137
|
|
|
127
138
|
return order
|
|
128
|
-
|
|
129
|
-
|
|
@@ -4,13 +4,11 @@ from investing_algorithm_framework.domain import ImproperlyConfigured
|
|
|
4
4
|
|
|
5
5
|
class FinterionPortfolioConfiguration(PortfolioConfiguration):
|
|
6
6
|
|
|
7
|
-
def __init__(self,
|
|
7
|
+
def __init__(self, trading_symbol, market_data_markets):
|
|
8
8
|
try:
|
|
9
9
|
super().__init__(
|
|
10
10
|
market="finterion",
|
|
11
11
|
trading_symbol=trading_symbol,
|
|
12
|
-
api_key=api_key,
|
|
13
|
-
secret_key=None,
|
|
14
12
|
)
|
|
15
13
|
except ImproperlyConfigured:
|
|
16
14
|
pass
|
|
@@ -24,5 +22,3 @@ class FinterionPortfolioConfiguration(PortfolioConfiguration):
|
|
|
24
22
|
@property
|
|
25
23
|
def identifier(self):
|
|
26
24
|
return "finterion"
|
|
27
|
-
|
|
28
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: finterion-investing-algorithm-framework
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: Official Finterion plugin for the investing algorithm framework
|
|
5
5
|
Home-page: https://github.com/finterion/finterion-investing-algorithm-framework.git
|
|
6
6
|
Author: Finterion
|
|
@@ -17,7 +17,7 @@ Classifier: Operating System :: OS Independent
|
|
|
17
17
|
Requires-Python: >=3
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: investing-algorithm-framework >=
|
|
20
|
+
Requires-Dist: investing-algorithm-framework >=2.0.2
|
|
21
21
|
Requires-Dist: finterion >=0.7.4
|
|
22
22
|
|
|
23
23
|
# Finterion Investing Algorithm Framework Plugin
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
finterion_investing_algorithm_framework/__init__.py,sha256=u-srn87VlLUPUJHWR5hgMAHqw2BWtb1v0eH0tQ8M16w,107
|
|
2
|
-
finterion_investing_algorithm_framework/create_app.py,sha256=
|
|
2
|
+
finterion_investing_algorithm_framework/create_app.py,sha256=TnWWKuQEpLtX23XC1-KOflrriidJoti0CMd1mSRw6bM,1654
|
|
3
3
|
finterion_investing_algorithm_framework/exceptions.py,sha256=KOaDjHQC7vNpKwYYNxJ2nuaJYceMmvExW3BLSzPSWJk,197
|
|
4
|
-
finterion_investing_algorithm_framework/market_service.py,sha256=
|
|
4
|
+
finterion_investing_algorithm_framework/market_service.py,sha256=b1KddReiKO70A2yjjny4yvhB7zTVCdAm_h-TafmZCZs,4282
|
|
5
5
|
finterion_investing_algorithm_framework/configuration/__init__.py,sha256=yz9TVm7RoGgF3EJ95-iLJrMup7eYoRvTXY1TyfEiGf4,42
|
|
6
6
|
finterion_investing_algorithm_framework/configuration/constants.py,sha256=bhabsdZ8omPvAZlQmdPGM70vHQHS2pcJm2olpkSEciU,93
|
|
7
7
|
finterion_investing_algorithm_framework/models/__init__.py,sha256=waEhKjOtg3oSSoyWHNFsQCcRklQm5EeOoAVCyEaMxSs,174
|
|
8
|
-
finterion_investing_algorithm_framework/models/portfolio_configuration.py,sha256=
|
|
9
|
-
finterion_investing_algorithm_framework-0.11.
|
|
10
|
-
finterion_investing_algorithm_framework-0.11.
|
|
11
|
-
finterion_investing_algorithm_framework-0.11.
|
|
12
|
-
finterion_investing_algorithm_framework-0.11.
|
|
13
|
-
finterion_investing_algorithm_framework-0.11.
|
|
8
|
+
finterion_investing_algorithm_framework/models/portfolio_configuration.py,sha256=ahRMjEWaymBn_z9ROBeU9jYmNANonqiXyqQf8hoYNEU,774
|
|
9
|
+
finterion_investing_algorithm_framework-0.11.2.dist-info/LICENSE,sha256=wbVEDvoZiMPHufRY3sLEffvAr7GH5hOIngHF8y4HFQg,11343
|
|
10
|
+
finterion_investing_algorithm_framework-0.11.2.dist-info/METADATA,sha256=xWFTB9KWLczzxidmd0lGdEJWejucw_klzxkbbT_96fo,2146
|
|
11
|
+
finterion_investing_algorithm_framework-0.11.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
12
|
+
finterion_investing_algorithm_framework-0.11.2.dist-info/top_level.txt,sha256=B97hJPQAFX_vRhcLE8uVZ6ac3a5ndS79p-O8-C2y-zw,40
|
|
13
|
+
finterion_investing_algorithm_framework-0.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|