saxo-api-client 1.0.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.
- saxo_api_client-1.0.0/.gitignore +107 -0
- saxo_api_client-1.0.0/CHANGELOG.md +13 -0
- saxo_api_client-1.0.0/LICENSE +22 -0
- saxo_api_client-1.0.0/PKG-INFO +232 -0
- saxo_api_client-1.0.0/README.ja.md +174 -0
- saxo_api_client-1.0.0/README.md +205 -0
- saxo_api_client-1.0.0/docs/README.md +151 -0
- saxo_api_client-1.0.0/docs/api/README.md +237 -0
- saxo_api_client-1.0.0/docs/api/accounthistory/README.md +123 -0
- saxo_api_client-1.0.0/docs/api/chart/README.md +46 -0
- saxo_api_client-1.0.0/docs/api/eventnotificationservices/README.md +52 -0
- saxo_api_client-1.0.0/docs/api/portfolio/README.md +152 -0
- saxo_api_client-1.0.0/docs/api/referencedata/README.md +169 -0
- saxo_api_client-1.0.0/docs/api/rootservices/README.md +175 -0
- saxo_api_client-1.0.0/docs/api/trading/README.md +133 -0
- saxo_api_client-1.0.0/docs/api/valueadd/README.md +57 -0
- saxo_api_client-1.0.0/docs/schemas/README.md +101 -0
- saxo_api_client-1.0.0/pyproject.toml +62 -0
- saxo_api_client-1.0.0/samples/README.md +60 -0
- saxo_api_client-1.0.0/saxo_api_client/__init__.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/auth/__init__.py +35 -0
- saxo_api_client-1.0.0/saxo_api_client/auth/client.py +339 -0
- saxo_api_client-1.0.0/saxo_api_client/auth/models.py +223 -0
- saxo_api_client-1.0.0/saxo_api_client/auth/redirect_server.py +82 -0
- saxo_api_client-1.0.0/saxo_api_client/auth/utils.py +68 -0
- saxo_api_client-1.0.0/saxo_api_client/client.py +683 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/__init__.py +23 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/client.py +359 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/option_finder.py +241 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/option_trader.py +659 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/option_types.py +87 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/__init__.py +32 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/baseorder.py +37 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/closure.py +141 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/helper.py +127 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/limitorder.py +385 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/marketorder.py +420 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/mixin.py +33 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/onfill.py +295 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/stopiftradedorder.py +283 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/stoplimitorder.py +295 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/orders/stoporder.py +355 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/session.py +69 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/util/__init__.py +3 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/util/instrument_to_uic.py +83 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/ws/__init__.py +0 -0
- saxo_api_client-1.0.0/saxo_api_client/contrib/ws/stream.py +45 -0
- saxo_api_client-1.0.0/saxo_api_client/definitions/__init__.py +6 -0
- saxo_api_client-1.0.0/saxo_api_client/definitions/accounthistory.py +153 -0
- saxo_api_client-1.0.0/saxo_api_client/definitions/activities.py +49 -0
- saxo_api_client-1.0.0/saxo_api_client/definitions/orders.py +197 -0
- saxo_api_client-1.0.0/saxo_api_client/definitions/reportformats.py +117 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/__init__.py +0 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/__init__.py +6 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/accountvalues.py +18 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/base.py +26 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/historicalpositions.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/performance.py +21 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/accounthistory/performance_v4.py +21 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/apirequest.py +64 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/chart/__init__.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/chart/base.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/chart/charts.py +71 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/decorators.py +85 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/eventnotificationservices/__init__.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/eventnotificationservices/base.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/eventnotificationservices/clientactivities.py +64 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/marketdata/__init__.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/marketdata/documents.py +29 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/__init__.py +12 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/accountgroups.py +59 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/accounts.py +119 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/balances.py +80 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/base.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/clients.py +71 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/closedpositions.py +123 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/exposure.py +121 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/netpositions.py +99 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/orders.py +98 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/positions.py +112 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/portfolio/users.py +76 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/__init__.py +10 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/algostrategies.py +43 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/base.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/countries.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/cultures.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/currencies.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/currencypairs.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/exchanges.py +43 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/instruments.py +76 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/languages.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/marketdata.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/standarddates.py +45 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/referencedata/timezones.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/__init__.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/base.py +19 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/diagnostics.py +89 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/features.py +45 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/sessions.py +53 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/subscriptions.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/rootservices/user.py +16 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/__init__.py +11 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/allocationkeys.py +65 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/base.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/infoprices.py +85 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/messages.py +73 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/multilegorders.py +66 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/multilegprices.py +30 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/optionschain.py +70 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/orders.py +58 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/positions.py +54 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/prices.py +58 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/prices_extensions.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/trading/trades.py +18 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/valueadd/__init__.py +1 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/valueadd/base.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/endpoints/valueadd/pricealerts.py +101 -0
- saxo_api_client-1.0.0/saxo_api_client/exceptions.py +38 -0
- saxo_api_client-1.0.0/saxo_api_client/models/__init__.py +2 -0
- saxo_api_client-1.0.0/saxo_api_client/models/_base.py +15 -0
- saxo_api_client-1.0.0/saxo_api_client/models/base.py +19 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/cashmanagement-beneficiaryinstructions.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/cashmanagement-cashwithdrawal.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/cashmanagement-cashwithdrawallimits.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/cashmanagement-interaccounttransfers.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/cashmanagement-periodicpayment.py +53 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/partner-cashtransfer.py +39 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/partner-cashtransferlimits.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/partner-prefunding.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/atr/securitiestransfers.py +151 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/elections.py +35 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/events.py +126 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/eventviews.py +102 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/holdings.py +32 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/proxyvoting.py +53 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ca/standinginstructions.py +64 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/chart/charts.py +147 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cm/accounts.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cm/clientrenewals.py +349 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cm/documents.py +29 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cm/signups.py +92 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cm/users.py +18 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cr/historicalreportdata-accountstatement.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cr/historicalreportdata-portfoliomanagement.py +34 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cr/historicalreportdata-tradedetails.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cr/historicalreportdata-tradesexecuted.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/audit-orderactivities.py +44 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/cashmanagement-interaccounttransfer.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/cashmanagement-wiretransfers.py +18 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/clientinfo.py +30 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/historicalreportdata-aggregatedamounts.py +24 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/historicalreportdata-bookings.py +32 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/historicalreportdata-closedpositions.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/historicalreportdata-trades.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/support-cases.py +85 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/tradingconditions-contractoption.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/tradingconditions-cost.py +112 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/cs/tradingconditions.py +108 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/dm/disclaimermanagement.py +28 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ens/clientactivities.py +166 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/hist/accountvalues.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/hist/historicalpositions.py +111 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/hist/performance.py +68 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/hist/transactions.py +38 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/hist/unsettledamounts.py +50 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/mkt/instrumentdocument.py +117 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/advisoryaccounts.py +67 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/externalaccounts.py +58 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/fundinginstruction.py +42 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/interactiveesigning.py +39 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/interactiveidverification.py +29 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/partnerbulkbookings.py +22 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/partnerintegration/updatepricing.py +104 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/accountgroups.py +91 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/accounts.py +335 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/balances.py +494 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/clients.py +254 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/closedpositions.py +306 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/exposure.py +285 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/netpositions.py +485 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/orders.py +615 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/positions.py +548 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/port/users.py +195 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/algostrategies.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/countries.py +26 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/cultures.py +23 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/currencies.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/currencypairs.py +17 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/exchanges.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/instruments.py +163 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/languages.py +24 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/standarddates.py +20 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/ref/timezones.py +26 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/reg/financialoverview.py +65 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/reg/investmentprofile.py +76 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/reg/knowledgeandexperience.py +25 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/allocationkeys.py +145 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/infoprices.py +172 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/messages.py +60 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/optionschain.py +125 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/orders.py +365 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/positions.py +115 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/prices.py +205 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/trade/trades.py +131 -0
- saxo_api_client-1.0.0/saxo_api_client/models/generated/vas/pricealerts.py +165 -0
- saxo_api_client-1.0.0/saxo_api_client/models/openapi.py +5296 -0
- saxo_api_client-1.0.0/saxo_api_client/models/portfolio.py +86 -0
- saxo_api_client-1.0.0/saxo_api_client/trace.py +277 -0
- saxo_api_client-1.0.0/saxo_api_client/types/__init__.py +56 -0
- saxo_api_client-1.0.0/saxo_api_client/types/primitives.py +62 -0
- saxo_api_client-1.0.0/saxo_api_client/types/responses.py +106 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
|
|
50
|
+
# Translations
|
|
51
|
+
*.mo
|
|
52
|
+
*.pot
|
|
53
|
+
|
|
54
|
+
# Django stuff:
|
|
55
|
+
*.log
|
|
56
|
+
local_settings.py
|
|
57
|
+
db.sqlite3
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation
|
|
67
|
+
docs/_build/
|
|
68
|
+
|
|
69
|
+
# PyBuilder
|
|
70
|
+
target/
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# pyenv
|
|
76
|
+
.python-version
|
|
77
|
+
|
|
78
|
+
# celery beat schedule file
|
|
79
|
+
celerybeat-schedule
|
|
80
|
+
|
|
81
|
+
# SageMath parsed files
|
|
82
|
+
*.sage.py
|
|
83
|
+
|
|
84
|
+
# Environments
|
|
85
|
+
.env
|
|
86
|
+
.venv
|
|
87
|
+
env/
|
|
88
|
+
venv/
|
|
89
|
+
ENV/
|
|
90
|
+
env.bak/
|
|
91
|
+
venv.bak/
|
|
92
|
+
|
|
93
|
+
# Spyder project settings
|
|
94
|
+
.spyderproject
|
|
95
|
+
.spyproject
|
|
96
|
+
|
|
97
|
+
# Rope project settings
|
|
98
|
+
.ropeproject
|
|
99
|
+
|
|
100
|
+
# mkdocs documentation
|
|
101
|
+
/site
|
|
102
|
+
|
|
103
|
+
# mypy
|
|
104
|
+
.mypy_cache/
|
|
105
|
+
|
|
106
|
+
# vs code stuff
|
|
107
|
+
.vscode
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 — 2026-07-10
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Package rename:** PyPI `saxo-api-client`, import `saxo_api_client` (formerly `saxo-openapi` / `saxo_openapi` fork).
|
|
8
|
+
- **Breaking:** Not compatible with hootnot `saxo-api-client` 0.6.0 on PyPI. See README migration notes.
|
|
9
|
+
- `saxo_api_client.py` core module renamed to `client.py` (`from saxo_api_client import API` unchanged).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `pyproject.toml` (hatchling) packaging for PyPI distribution.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Feite Brekeveld
|
|
4
|
+
Copyright (c) 2025 nohikomiso
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: saxo-api-client
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI-ready Saxo Bank OpenAPI REST/WebSocket client (Python 3.13+)
|
|
5
|
+
Project-URL: Homepage, https://github.com/nohikomiso/saxo-api-client
|
|
6
|
+
Project-URL: Repository, https://github.com/nohikomiso/saxo-api-client
|
|
7
|
+
Project-URL: Issues, https://github.com/nohikomiso/saxo-api-client/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/nohikomiso/saxo-api-client/blob/master/CHANGELOG.md
|
|
9
|
+
Author: nohikomiso
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api-client,openapi,saxo,saxo-bank,saxobank,trading
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Requires-Python: >=3.13
|
|
20
|
+
Requires-Dist: flask
|
|
21
|
+
Requires-Dist: httpx
|
|
22
|
+
Requires-Dist: loguru
|
|
23
|
+
Requires-Dist: pydantic>=2.0
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: websockets
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# saxo-api-client (AI-Ready)
|
|
29
|
+
|
|
30
|
+
English | [日本語](./README.ja.md)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+

|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
A modern client library designed to access Saxo Bank OpenAPI from Python, featuring **optimizations for AI assistants (AI-First)** to ensure efficiency and safety.
|
|
41
|
+
|
|
42
|
+
This library is a fork and re-architected version of the original [hootnot/saxo_openapi](https://github.com/hootnot/saxo_openapi) optimized for modern AI-assisted development workflows. **Today's advancement is built on the extensive initial efforts and implementations of the original author, hootnot.**
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 💎 Key Features: AI-First Documentation
|
|
47
|
+
|
|
48
|
+
The defining feature of this library is its design, which allows AI assistants (Claude, GPT-4, Gemini, etc.) to retrieve accurate information and support developers with minimal token consumption.
|
|
49
|
+
|
|
50
|
+
1. **Separation of Documentation**: Detailed docstrings have been offloaded from the Python code to external Markdown files (`docs/api/`). AI assistants only read documentation when necessary, conserving context window space.
|
|
51
|
+
2. **AI Navigation Map (`.ai/index.json`)**: All endpoints, categories, and use cases are indexed in structured JSON metadata. AI assistants can find target endpoints instantly.
|
|
52
|
+
3. **Rich Examples and Schemas**: Includes over 275 JSON Schemas (`docs/schemas/`) and ready-to-run workflow examples (`docs/examples/`).
|
|
53
|
+
4. **Strict Typing (Python 3.13+)**: Designed for static analysis using tools like `mypy` to prevent runtime bugs before they happen.
|
|
54
|
+
5. **Dynamic Rate Limit Handling**: Automatically detects HTTP 429 rate limit errors from the API, dynamically parses the rate limit reset time, waits, and retries.
|
|
55
|
+
6. **Robust Authentication Support**: Fully integrated OAuth 2.0 authentication and session management. No external libraries required.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📚 Documentation Portal
|
|
60
|
+
|
|
61
|
+
Please refer to the guides inside the `docs/` directory for detailed information:
|
|
62
|
+
|
|
63
|
+
- **[Master Index (docs/README.md)](docs/README.md)** - Entry point to all documentation.
|
|
64
|
+
- **[Quick Start Guide (docs/quickstart.md)](docs/quickstart.md)** - Run your first request in 5 minutes.
|
|
65
|
+
- **[Authentication Guide (docs/authentication.md)](docs/authentication.md)** - Connection configuration and token lifecycle.
|
|
66
|
+
- **[AI-First Migration Guide (docs/MIGRATION.md)](docs/MIGRATION.md)** - Key differences from the legacy library architecture.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🚀 Quick Start
|
|
71
|
+
|
|
72
|
+
### Installation
|
|
73
|
+
|
|
74
|
+
**Using pip (PyPI)**
|
|
75
|
+
```bash
|
|
76
|
+
pip install saxo-api-client
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Using pip (GitHub)**
|
|
80
|
+
```bash
|
|
81
|
+
pip install git+https://github.com/nohikomiso/saxo-api-client.git
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Using uv**
|
|
85
|
+
```bash
|
|
86
|
+
uv add git+https://github.com/nohikomiso/saxo-api-client.git
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Your First Request
|
|
90
|
+
|
|
91
|
+
### Your First Request (Using SaxoClient Facade)
|
|
92
|
+
|
|
93
|
+
The `SaxoClient` is the unified facade class that provides an intuitive, one-liner interface for all common trading operations, completely hiding the complex underlying endpoints.
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import json
|
|
97
|
+
from saxo_api_client.contrib.client import SaxoClient
|
|
98
|
+
from saxo_api_client.auth import SaxoAuthClient
|
|
99
|
+
from saxo_api_client import AssetType, OrderType
|
|
100
|
+
|
|
101
|
+
# Optional: Define a callback to securely save the token when it refreshes
|
|
102
|
+
def save_token(token_data):
|
|
103
|
+
with open("token.json", "w") as f:
|
|
104
|
+
json.dump(token_data.model_dump(), f)
|
|
105
|
+
|
|
106
|
+
# 1. Initialize the Auth Client and login
|
|
107
|
+
auth = SaxoAuthClient(app_config="app_config.json", on_token_refresh=save_token)
|
|
108
|
+
auth.login(launch_browser=True, catch_redirect=True)
|
|
109
|
+
|
|
110
|
+
# 2. Initialize the ultimate facade client
|
|
111
|
+
client = SaxoClient(auth_client=auth)
|
|
112
|
+
|
|
113
|
+
# Check account balance with a single line
|
|
114
|
+
balance = client.get_account_balance()
|
|
115
|
+
print("Balance:", balance)
|
|
116
|
+
|
|
117
|
+
# Safely check if the market is open and the order is accepted
|
|
118
|
+
if client.is_order_accepted(symbol="AAPL", asset_type=AssetType.CfdOnStock, order_type=OrderType.Market):
|
|
119
|
+
# Place a market order without worrying about Uic resolution
|
|
120
|
+
response = client.market_order(
|
|
121
|
+
symbol="AAPL",
|
|
122
|
+
amount=10,
|
|
123
|
+
asset_type=AssetType.CfdOnStock
|
|
124
|
+
)
|
|
125
|
+
print("Order placed:", response)
|
|
126
|
+
else:
|
|
127
|
+
print("Market is closed or order type not accepted.")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### API Request/Response Tracing (For Research and Debugging)
|
|
131
|
+
|
|
132
|
+
When researching new features or API behaviors, you can configure the client to record request and response pairs as local JSON files (usually disabled in production).
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
export SAXO_OPENAPI_TRACE=1
|
|
136
|
+
export SAXO_OPENAPI_TRACE_DIR=api_traces
|
|
137
|
+
uv run python your_research_script.py
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
client = API(access_token=token, trace_dir="api_traces") # Can also be enabled via parameter
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Save path: `api_traces/{YYYYMMDD}/saxo_{endpoint}_{trace_id}.json` (add to gitignore).
|
|
145
|
+
- Verified responses can be manually promoted to the `response/` folder of this repo.
|
|
146
|
+
- Sensitive information like tokens and `AccountKey` are automatically masked.
|
|
147
|
+
|
|
148
|
+
## 🏛 The 3-Tier Architecture
|
|
149
|
+
|
|
150
|
+
To shield developers from the complexity of Saxo Bank's APIs (such as mandatory `AccountKey` injection and resolving Tickers to numeric `Uic`s), this library provides a robust 3-Tier Architecture.
|
|
151
|
+
|
|
152
|
+
- **Layer 3 (High-Level API - Recommended)**: `SaxoTrader`, `OptionTrader`
|
|
153
|
+
- The primary interface for trading. Provides intuitive methods like `market_order(Symbol="AAPL", AssetType="Stock")`.
|
|
154
|
+
- Automatically resolves Tickers (Symbol) to `Uic` (including smart fallback via `PrimaryListing` for multiple hits).
|
|
155
|
+
- Automatically injects the `AccountKey` and constructs the necessary nested order parameters.
|
|
156
|
+
- **Layer 2 (Order Builders)**: `MarketOrder`, `LimitOrder`, `StopOrder`, etc.
|
|
157
|
+
- Used for advanced customization. These helpers allow you to build complex order structures manually when Layer 3 doesn't cover your specific edge case.
|
|
158
|
+
- **Layer 1 (OpenAPI FlexModels)**: Pydantic `_FlexModel` (`TradeOrdersRequest`, etc.)
|
|
159
|
+
- The infrastructure layer. Enforces strict OpenAPI JSON validation before requests are sent to Saxo. Developers rarely interact with this layer directly.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 🛠 Recommended Architecture
|
|
164
|
+
|
|
165
|
+
To maximize the benefits of this library and run 24/7 stable algorithmic trading, we recommend the following "Separation of Concerns" multi-service configuration.
|
|
166
|
+
|
|
167
|
+
### 1. Separation of Auth and Trading Operations
|
|
168
|
+
Run the authentication manager and the trading/data execution logic in separate, independent processes.
|
|
169
|
+
|
|
170
|
+
- **Auth Service (using [Saxo-APY](https://github.com/nohikomiso/saxo-apy))**: Handles OAuth logins, keeps the session alive, and writes the latest token to a local file (e.g., `saxo_token.json`).
|
|
171
|
+
- **Trading Services (using Saxo-OpenAPI)**: Simply reads the saved token file to execute commands like balance retrieval, price monitoring, or orders without needing to handle the OAuth flow directly.
|
|
172
|
+
|
|
173
|
+
### 2. Advantages
|
|
174
|
+
- **Robustness**: If an authentication issue occurs, the Auth Service handles recovery without needing to restart the active trading loops.
|
|
175
|
+
- **Scalability**: Multiple independent micro-services (e.g., market monitor, execution engine, notifier) can run concurrently by referencing the single token file.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## ⚠️ Disclaimer: Streaming Features
|
|
180
|
+
|
|
181
|
+
The streaming features in this library (Saxo-OpenAPI) are currently under active development and considered incomplete.
|
|
182
|
+
|
|
183
|
+
- **Supported Scope**: Basic connectivity establishment and resource subscription registration are tested and work.
|
|
184
|
+
- **Missing Features**: Message decoding efficiency, dynamic reconnection handling, parallel processing safety, and performance optimization are not yet implemented.
|
|
185
|
+
- **Recommendation**: For production real-time trading or heavy data ingestion, **do not rely on the built-in streaming features; implement your own robust stream handling instead.**
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 📂 Directory Structure
|
|
190
|
+
|
|
191
|
+
- `saxo_api_client/`: Core library source code. Compact docstrings optimized for AI tools.
|
|
192
|
+
- `docs/api/`: **[Main]** Japanese documentation for all endpoints.
|
|
193
|
+
- `docs/schemas/`: Over 270 JSON Schemas representing requests and responses.
|
|
194
|
+
- `docs/examples/`: Practical workflow examples (balance check, order execution, streaming, etc.).
|
|
195
|
+
- `saxo_api_client/contrib/`: Helper classes to simplify order construction (`SaxoTrader`, etc.).
|
|
196
|
+
- `samples/`: **[New]** Example scripts to verify operations in real/SIM environments (FX, options, order lifecycles).
|
|
197
|
+
- `tests/`: Unit and integration tests for the library.
|
|
198
|
+
- `.ai/`: Structured index and metrics metadata for AI assistants.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 🧪 Testing & Verification
|
|
203
|
+
|
|
204
|
+
The `samples/` directory contains various scripts simulating actual trading workflows:
|
|
205
|
+
- `verify_lifecycle_trading.py`: Confirms the entire lifecycle of an order from submission to execution.
|
|
206
|
+
- `verify_refdata_fx.py`: Fetches reference data for FX currency pairs.
|
|
207
|
+
- `verify_portfolio_fx.py`: Checks portfolio balance and position configurations.
|
|
208
|
+
|
|
209
|
+
These serve as excellent reference material for utilizing the library.
|
|
210
|
+
|
|
211
|
+
You can also run unit tests with:
|
|
212
|
+
```bash
|
|
213
|
+
pytest tests/
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🔗 Related Resources
|
|
219
|
+
|
|
220
|
+
- **[SaxoBank OpenAPI Docs (Markdown Version)](https://github.com/nohikomiso/SaxoBank-OpenAPI-Docs)**: A community-maintained Markdown version of Saxo's official developer documentation.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 🙏 Acknowledgments
|
|
225
|
+
|
|
226
|
+
The core codebase of this project and the foundation of wrapping Saxo OpenAPI in Python were passionately developed by **[hootnot (GitHub)](https://github.com/hootnot)**.
|
|
227
|
+
|
|
228
|
+
The design principles established by him over years of maintenance allowed us to evolve this library into a modern "AI-First" tool. **Regardless of current maintenance status, we express our highest respect and gratitude for his pioneering work.**
|
|
229
|
+
|
|
230
|
+
## ⚖️ License
|
|
231
|
+
|
|
232
|
+
MIT License (inherited from the original repository). See `LICENSE` for details.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Saxo-OpenAPI (AI-Ready)
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | 日本語
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
Saxo Bank OpenAPI を Python から効率的かつ安全に利用するための、**AI アシスタントへの最適化 (AI-First)** を施した現代的なクライアントライブラリです。
|
|
14
|
+
|
|
15
|
+
このライブラリは、オリジナルの [hootnot/saxo_openapi](https://github.com/hootnot/saxo_openapi) をベースに、AI 時代の開発フローに合わせてアーキテクチャから再設計されたフォーク・バージョンです。**今日の発展は、オリジナルの作者である hootnot 氏による多大なる初期の努力と実装があったからこそ実現しました。**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 💎 特徴:AI-First Documentation
|
|
20
|
+
|
|
21
|
+
本ライブラリの最大の特徴は、AI アシスタント(Claude, GPT-4, Gemini 等)が最小限のトークン消費で正確な情報を取得し、ユーザーをサポートできるように設計されている点です。
|
|
22
|
+
|
|
23
|
+
1. **ドキュメントの完全分離**: Python コードから詳細な docstring を外部の Markdown ファイル(`docs/api/`)へ移管。AI は必要な時に必要なドキュメントだけを参照するため、コンテキストを節約できます。
|
|
24
|
+
2. **AI ナビゲーション (`.ai/index.json`)**: 全エンドポイント、カテゴリ、ユースケースを構造化された JSON メタデータで管理。AI は目的のエンドポイントを瞬時に検索可能です。
|
|
25
|
+
3. **豊富な実行例とスキーマ**: 275個以上の JSON Schema (`docs/schemas/`) と、すぐに試せるワークフロー例 (`docs/examples/`) が用意されています。
|
|
26
|
+
4. **厳格な型定義 (Python 3.13+)**: `mypy` 等での静的解析を前提とした設計により、開発時のバグを未然に防ぎます。
|
|
27
|
+
5. **動的レート制限処理**: API からの 429 エラーを検知し、リセット時間を動的に解析して自動待機・リトライを行います。
|
|
28
|
+
6. **堅牢な認証基盤の内包**: OAuth 2.0 認証およびセッション管理機能を完全に内包しており、外部ライブラリなしで完結します。
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📚 ドキュメントポータル
|
|
33
|
+
|
|
34
|
+
詳細な情報は `docs/` ディレクトリ内の各ガイドを参照してください。
|
|
35
|
+
|
|
36
|
+
- **[総合インデックス (docs/README.md)](docs/README.md)** - ドキュメント全体の入り口
|
|
37
|
+
- **[クイックスタート (docs/quickstart.md)](docs/quickstart.md)** - 5分で最初のリクエストを実行
|
|
38
|
+
- **[認証ガイド (docs/authentication.md)](docs/authentication.md)** - 接続設定とトークン管理
|
|
39
|
+
- **[AI-First 移行ガイド (docs/MIGRATION.md)](docs/MIGRATION.md)** - 旧アーキテクチャからの変更点
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🚀 クイックスタート
|
|
44
|
+
|
|
45
|
+
### インストール
|
|
46
|
+
|
|
47
|
+
**pip を使用する場合**
|
|
48
|
+
```bash
|
|
49
|
+
pip install git+https://github.com/nohikomiso/saxo-api-client.git
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**uv を使用する場合**
|
|
53
|
+
```bash
|
|
54
|
+
uv add git+https://github.com/nohikomiso/saxo-api-client.git
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 最初のリクエスト
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import os
|
|
61
|
+
import json
|
|
62
|
+
from saxo_api_client import API
|
|
63
|
+
from saxo_api_client.auth import SaxoAuthClient
|
|
64
|
+
import saxo_api_client.endpoints.portfolio as pf
|
|
65
|
+
|
|
66
|
+
# オプション: トークンがリフレッシュされた時に安全に保存するためのコールバックを定義
|
|
67
|
+
def save_token(token_data):
|
|
68
|
+
with open("token.json", "w") as f:
|
|
69
|
+
json.dump(token_data.model_dump(), f)
|
|
70
|
+
|
|
71
|
+
# 1. 認証クライアントの初期化とログイン
|
|
72
|
+
auth = SaxoAuthClient(app_config="app_config.json", on_token_refresh=save_token)
|
|
73
|
+
auth.login(launch_browser=True, catch_redirect=True)
|
|
74
|
+
|
|
75
|
+
# 2. 認証済みクライアントをそのままAPIに渡して初期化
|
|
76
|
+
client = API(auth_client=auth)
|
|
77
|
+
|
|
78
|
+
# 口座残高の確認 (詳細は docs/api/portfolio/balances.md 参照)
|
|
79
|
+
r = pf.balances.AccountBalancesMe()
|
|
80
|
+
rv = client.request(r)
|
|
81
|
+
|
|
82
|
+
print(rv)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### API 送受信トレース(調査・実験用)
|
|
86
|
+
|
|
87
|
+
新機能や API 挙動の調査時は、クライアントで **リクエストとレスポンスのペア** をローカル JSON に保存できます(本番 01–05 では通常 OFF)。
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
export SAXO_OPENAPI_TRACE=1
|
|
91
|
+
export SAXO_OPENAPI_TRACE_DIR=api_traces
|
|
92
|
+
uv run python your_research_script.py
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
client = API(access_token=token, trace_dir="api_traces") # 引数でも有効化可
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- 保存先: `api_traces/{YYYYMMDD}/saxo_{endpoint}_{trace_id}.json`(gitignore 推奨)
|
|
100
|
+
- 確定した証跡はリポジトリの `response/` へ手動で昇格(研究手順: リポジトリルート `docs/saxo-api-research-rhythm.md`)
|
|
101
|
+
- トークン・AccountKey 等は自動マスク
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🛠 推奨されるシステム構成
|
|
106
|
+
|
|
107
|
+
本ライブラリを最大限に活用し、24 時間 365 日安定したアルゴリズム取引を実現するための「推奨構成(マルチサービス・アーキテクチャ)」を紹介します。
|
|
108
|
+
|
|
109
|
+
### 1. 認証と操作の分離 (Separation of Concerns)
|
|
110
|
+
認証管理と実際の取引・データ取得ロジックを別々のプロセスとして運用する構成です。
|
|
111
|
+
|
|
112
|
+
- **認証サービス (Auth Service)**: [Saxo-APY](https://github.com/nohikomiso/saxo-apy) を使用。OAuth 認証を行い、取得したトークンを常に最新の状態に保ちながらファイル(例: `saxo_token.json`)に保存し続けます。
|
|
113
|
+
- **取引サービス (Trading Services)**: 本ライブラリ(Saxo-OpenAPI)を使用。保存されたトークンファイルを読み込むだけで、認証手順を気にすることなく「残高取得」「価格監視」「注文執行」といった本来のロジックに集中できます。
|
|
114
|
+
|
|
115
|
+
### 2. メリット
|
|
116
|
+
- **堅牢性**: 認証エラーが発生しても、取引ロジック自体を再起動することなく、認証サービス側で復旧を試みることができます。
|
|
117
|
+
- **拡張性**: 1 つの共通トークンファイルを参照することで、「監視サービス」「執行サービス」「通知サービス」など、複数の独立したプロセスを容易に追加・同時稼働させることが可能です。
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## ⚠️ 注意事項:ストリーミング機能について
|
|
122
|
+
|
|
123
|
+
本ライブラリ(Saxo-OpenAPI)に含まれるストリーミング関連の機能は、現時点では「開発途上(不十分)」な状態です。
|
|
124
|
+
|
|
125
|
+
- **サポート範囲**: 主に **「ストリーミング接続の確立」** および **「サブスクリプション(購読)の登録」** 程度しか正常動作が確認されていません。
|
|
126
|
+
- **不足している機能**: 受信メッセージの効率的なデコード、動的な再接続ロジック、複雑な並列処理、およびパフォーマンスの最適化などは実装されていません。
|
|
127
|
+
- **推奨事項**: 本格的なリアルタイムトレードや大規模なデータ取得を行う場合は、本ライブラリの内蔵機能に頼らず、**用途に合わせた独自のストリーミング受信実装を構築することを強く推奨します。**
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 📂 ディレクトリ構成
|
|
132
|
+
|
|
133
|
+
- `saxo_api_client/`: ライブラリの本体コード。ロジックに集中した最小限の docstring。
|
|
134
|
+
- `docs/api/`: **[メイン]** 全エンドポイントの日本語ドキュメント。
|
|
135
|
+
- `docs/schemas/`: リクエスト/レスポンスの JSON Schema 群(約 270 ファイル)。
|
|
136
|
+
- `docs/examples/`: 実践的なワークフロー例(残高確認、注文、ストリーミング等)。
|
|
137
|
+
- `saxo_api_client/contrib/`: 注文作成を簡素化する高機能ヘルパークラス (`SaxoTrader` 等)。
|
|
138
|
+
- `samples/`: **[NEW]** 実環境での動作を検証するためのサンプルスクリプト群(FX, オプション, 注文ライフサイクル等)。
|
|
139
|
+
- `tests/`: ライブラリ自体の単体テスト・結合テスト。
|
|
140
|
+
- `.ai/`: AI アシスタント用の構造化インデックスとメトリクス。
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 🧪 検証とテスト
|
|
145
|
+
|
|
146
|
+
`samples/` ディレクトリには、実際の取引シナリオをシミュレートする検証スクリプトが豊富に用意されています:
|
|
147
|
+
- `verify_lifecycle_trading.py`: 注文の発注から約定までのライフサイクル動作確認
|
|
148
|
+
- `verify_refdata_fx.py`: 通害ペアの参照データ取得
|
|
149
|
+
- `verify_portfolio_fx.py`: ポートフォリオの残高・ポジション確認
|
|
150
|
+
|
|
151
|
+
これらのスクリプトは、ライブラリの正しい動作を実環境で確認するための最良のリファレンスとなります。
|
|
152
|
+
|
|
153
|
+
また、単体テストは以下のコマンドで実行可能です:
|
|
154
|
+
```bash
|
|
155
|
+
pytest tests/
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 🔗 関連リソース
|
|
161
|
+
|
|
162
|
+
- **[SaxoBank OpenAPI Docs (Markdown版)](https://github.com/nohikomiso/SaxoBank-OpenAPI-Docs)**: Saxo 公式ドキュメントの Markdown 公開版。
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🙏 謝辞 (Acknowledgments)
|
|
167
|
+
|
|
168
|
+
本プロジェクトの核心的なコードベース、および Saxo OpenAPI を Python で叩くための基盤は、元々 **[hootnot (GitHub)](https://github.com/hootnot)** 氏によって情熱を持って開発されました。
|
|
169
|
+
|
|
170
|
+
氏が長年をかけて積み上げた実装、および Saxo OpenAPI への深い理解に基づく初期の設計があったからこそ、私はこの強力な「AI-First」な新世代ライブラリへと進化させることができました。**たとえ現在のメンテナンス状況がどうあれ、氏の先駆的な貢献と多大な努力に対し、心から最大の敬意と感謝を表します。**
|
|
171
|
+
|
|
172
|
+
## ⚖️ ライセンス
|
|
173
|
+
|
|
174
|
+
MIT License (オリジナルのライセンスを継承)。詳細は `LICENSE` を参照してください。
|