Code Monkey home page Code Monkey logo

shioaji's Introduction

Shioaji

shioaji-logosinopac-logo

PyPI - Status PyPI - Python Version PyPI - Downloads Coverage Binder doc Telegram

Shioaji is a trading API provided by Sinopac that offers a comprehensive and user-friendly platform for accessing the Taiwan financial markets. With Shioaji, you can trade a variety of financial instruments including stocks, futures, and options using your favorite Python packages such as numpy, scipy, pandas, pytorch, or tensorflow to build your own custom trading models. The platform is easy to use and intuitive, with advanced charting tools, real-time market data, and a customizable interface that allows you to tailor your trading experience to your specific needs. Shioaji is fast and efficient, with a high-performance core implemented in C++ and using FPGA event broker technology, and it is the first Python trading API in Taiwan that is compatible with Linux and Mac, making it a truly cross-platform solution. Whether you are a beginner looking to get started in the world of trading or an experienced trader looking for a more powerful platform, Shioaji has something to offer. Sign up for a free account today and start trading with confidence.

Installation

Binaries

simple using pip to install

pip install shioaji

Docker Image

simple run with interactive mode in docker

docker run -it sinotrade/shioaji:latest

or

docker run -it sinotrade/shioaji:{version}

run with jupyter lab or notebook

docker run -p 8888:8888 sinotrade/shioaji:jupyter

Initialization

import shioaji as sj

api = sj.Shioaji()
accounts = api.login("YOUR_TOKEN", "YOUR_SECRET_KEY")
api.activate_ca(
    ca_path="/c/your/ca/path/Sinopac.pfx",
    ca_passwd="YOUR_CA_PASSWORD",
    person_id="person_id of this ca",
)

Just import our API library like other popular python library and new the instance to start using our API. Login your account and activate the certification then you can start placing order.

api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="tick")
api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="bidask")
api.quote.subscribe(api.Contracts.Futures["TXFC0"], quote_type="tick")

Subscribe the real time market data. Simplely pass contract into quote subscribe function and give the quote type will receive the streaming data.

contract = api.Contracts.Stocks["2890"]
order = api.Order(
    price=9.6,
    quantity=1,
    action="Buy",
    price_type="LMT",
    order_type="ROD",
    order_lot="Common",
    account=api.stock_account,
)
# or
order = api.Order(
    price=9.6,
    quantity=1,
    action=sj.constant.Action.Buy,
    price_type=sj.constant.StockPriceType.LMT,
    order_type=sj.constant.OrderType.ROD,
    order_lot=sj.constant.StockOrderLot.Common,
    account=api.stock_account,
)
trade = api.place_order(contract, order)

Like the above subscribing market data using the contract, then need to define the order. Pass them into place_order function, then it will return the trade that describe the status of your order.

Conclusion

This quickstart demonstrates how easy to use our package for native Python users. Unlike many other trading API is hard for Python developer. We focus on making more pythonic trading API for our users.

More usage detail on document.

doc

Communication

Telegram

Releases and Contributing

Shioaji has a 14 day release cycle. See the release change log. Please let us know if you encounter a bug by filing an issue.

We appreciate all suggestions. If you have any idea want us to implement, please discuss with us in gitter.

The Team

Shioaji is currently maintained by Sally, Yvictor, CC.Chiao and Po Chien Yang with major contributions.

shioaji's People

Contributors

gitter-badger avatar ypochien avatar yvictor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shioaji's Issues

何時會發生connection lost?

閒置一段時間(隔日)後會發生如下錯誤:

Exception in callback _SelectorTransport._call_connection_lost(ConnectionRes..., 10054, None)) handle: <Handle _SelectorTransport._call_connection_lost(ConnectionRes..., 10054, None))> Traceback (most recent call last): File "d:\ide\Python\Python36_x64\lib\asyncio\events.py", line 127, in _run self._callback(*self._args) File "d:\ide\Python\Python36_x64\lib\asyncio\selector_events.py", line 663, in _call_connection_lost self._protocol.connection_lost(exc) File "shioaji\backend\socket\connect.pyx", line 251, in shioaji.backend.socket.connect.Socket.connection_lost AttributeError: 'Socket' object has no attribute '_logger'

Missing wheel files of python 3.6 and 3.7 windows amd64 for 0.2.0.dev1 on pypi

020_dev0

020_dev1
Hi,
As first pic showes, there used to be wheel files for python 3.6/3.7 win amd64 on pypi.
However, for the latest 0.2.0.dev1, there is only python 3.5 wheel for win amd64 as second pic shows.
Is it intended? People using python 3.6 or 3.7 could not install Shioaji on a win amd64 machine for the latest version by pip now.
Could you please check? Thanks.

Fix backends

Python 的 dictionary 是 unorder
dict.values 的 output 順序不保證。

--- shioaji.py.orig     2019-03-29 11:00:18.145788028 +0800
+++ shioaji.py  2019-03-29 11:04:17.326463142 +0800
@@ -1,4 +1,4 @@
-from shioaji.backend import get_backends
+from shioaji import backend
 from shioaji.backend.solace.quote import Quote
 import datetime as dt
 from shioaji.order import Order
@@ -48,7 +48,7 @@
             currency (str): {NTX, USX, NTD, USD, HKD, EUR, JPY, GBP}
                 set the default currency for display 
         """
-        _http, _socket = get_backends().values()
+        _http, _socket = backend.http, backend.socket
         self.quote = Quote()
         self._http = _http(simulation, proxies)
         self._socket = _socket(simulation, proxies)
--- backend/__init__.py.orig    2019-03-29 11:01:03.124408744 +0800
+++ backend/__init__.py 2019-03-29 11:01:36.975371308 +0800
@@ -1,10 +1,2 @@
-from shioaji.backend.http import HttpApi
-from shioaji.backend.socket import Wrapper
-
-
-def get_backends():
-    apis = {
-        'http': HttpApi,
-        'socket': Wrapper,
-    }
-    return apis
+from shioaji.backend.http import HttpApi as http
+from shioaji.backend.socket import Wrapper as socket

憑證無法讀取

你好
最近用python api下單
登入的時候沒問題
可是發現憑證的讀取出問題
可是我用桌面eleader下單是可以的
不知道是不是套件出問題

FireShot Capture 066 - sinopac - localhost

Option order price is wrong

My sample code is as followed:

contract = api.Contracts.Options.TXO.TXO20200409800C
order = api.Order(action="Buy",
                price=1,
                quantity=1,
                order_type="ROD",
                price_type="LMT",
                octype="Auto",
                account=api.futopt_account)
trade = api.place_order(contract, order)

I just tried the order api on TXF and TXO. It seems working properly on TXF. However, the order price that comes out for TXO is absolutely making no sense.
image

Please help to check it. Thanks.

trade.status.status回传清单

请问, trade = api.place_order(self.TradedTarget, Buy_order)
trade.status.status 回传讯息只有“PendingSubmit” ,“Submitted”?
已成交会回传什么? 已撮合未成交会回传什么?

可否提供回传讯息的明细

查詢歷史Ticks問題

1585124732209

如圖上顯示,回傳的ticks除了 ts, volume, close 以外其他欄位都是0

請問這是Code的部分有問題嗎

It seems that it's not friendly for Options in Quote functions.

The APIs are friendly for Stocks and Futures, but not for Options.
I use the APIs to do Option quoting and encounter the error response "Max Num Subscriptions Exceeded".
I think that "Is there a method to subscribe the big title like "TXO201904" or "TXO201904W4" which tag does not include the details (like TXO201904W4C10100,TXO201904W4P10100,TXO201904W4C10200,TXO201904W4P10200)?"
Thanks.

Tick資料沒有內外盤價格

通常成交明細不外乎包含:內盤價、外盤價、成交價、成交時間、成交單量

但是使用 api.quote.subscribe(api.Contracts.Stocks["2890"], quote_type='tick')

MKT/redisrd/TSE/2330 {'Close': [239.5], 'Time': '11:11:42.624718', 'VolSum': [12206], 'Volume': [5]}

只有 成交價、時間、單量、總量,缺乏內盤價跟外盤價

建議可以補上

cannot install package on macOS 10.14.6

Try to install on macOS, but failed. (On Debian Linux, it work well)

$ python --version
Python 3.7.1

$ pip3 install shioaji
Collecting shioaji
ERROR: Could not find a version that satisfies the requirement shioaji (from versions: none)
ERROR: No matching distribution found for shioaji

Unable to place options order

Hi,

我在試臺指選的時候遇到了點問題:

In [67]: c = api.Contracts.Options.TX1.TX1202007011650P

In [68]: order = api.Order(
    ...:     action=sj.constant.Action.Buy,
    ...:     price=10,
    ...:     quantity=1,
    ...:     order_type=sj.constant.ORDER_TYPE_ROD,
    ...:     price_type='LMT',
    ...:     octype='Auto',
    ...:     account=api.futopt_account
    ...:     )

In [69]: trade = api.place_order(c, order)

OrderState.FOrder {'operation': {'op_type': 'New', 'op_code': '99S2', 'op_msg': '交易商品不存在/下市(FTTM)'}, ...}

請問有沒有盤後股價資料

問題 1. 請問有沒有python的指令可以在盤後將當天的股價資料載入?
問題 2. 用api.quote.subscribe()讀取當天的股價後,該怎麼讓資料寫入到txt檔中?
問題 3. 用api.login登入結果出現連不上線的情況,該怎麼處理?

The arg `cb` of `api.place_order` not works

In [43]: ?api.place_order
Signature:
api.place_order(
    contract:shioaji.contracts.Contract,
    order:shioaji.order.Order,
    timeout:int=5000,
    cb:Callable[[shioaji.order.Trade], NoneType]=None,
) -> shioaji.order.Trade
Docstring:
placing order

Args:
    contract (:obj:Shioaji.Contract):
    order (:obj:Shioaji.Order):
        pass Shioaji.Order object to place order
File:      ~/code/shioaji/shioaji/shioaji.py
Type:      method

In [44]: def f(trade):
    ...:     assert False
    ...: 

In [45]: trade = api.place_order(c, o, cb=f)

但 AssertError 並沒有出現

小道瓊期貨

您好,請問目前有小道瓊期貨(YMM20.IF)的即時資料嗎?謝謝

無法從Contracts中取得Stock的商品資料

我等入以後,透過api.list_accounts()可以看到有一個期貨帳戶跟一個股票帳戶
再來我透過api.set_default_account(api.stock_account)將股票帳戶設為預設
但設定完後,在api.Contracts還是沒有股票商品的資訊
Contracts(Stocks=(), Futures=(BRF, EXF, GDF, MXF, RHF, RTF, SPF, TGF, TXF, UDF, XAF, XBF, XEF, XJF), Options=(TXO))
同時api.get_account_margin()回傳的也是期貨帳戶的資訊

請問我有任何辦法可以解決該問題,取得股票商品的Contracts資訊嗎?

error install

pip3 install shioaji

ERROR: Could not find a version that satisfies the requirement shioaji (from versions: none)
ERROR: No matching distribution found for shioaji

這套件還有在維護嗎?

place_order() return Status.Inactive

執行 place_order() 後,trade object 回應 status=OrderStatus(status=<Status.Inactive: 'Inactive'>),
重新啟動程式執行後是可以成功的。
目前懷疑是程式後 login Session 啟動就放著不動一天後,Session 可能斷掉了,
請問是否有建議如何偵測/判別 Session 狀態,然後重新登入,謝謝。

verison:0.3.0.dev0

加權指數資訊、財報資訊

建議新增
1.加權指數即時資訊
ex:大盤預估量、委買委賣、成交筆數等
2.個股財報 (綜合損益表、資產負債表、現金流量表、股利政策表、除權除息結果表、月營收表)

Thanks!

程式登出後 api.list_trades() 未包含先前的掛單

問題描述

程式登出或是 api 物件重新生成(多重登入)時,呼叫 api.list_trades() 未顯示當日的掛單。 若使用 api.update_status() 也無法顯示掛單。

預期回傳

list_trades() 應該要包含當日的進出,否則這對部分操作示會有影響的。舉例來說,在這狀況下使用 cancel_order() 是不太方便的,由於該函示要求傳入 trade 物件 (而非order id),但文件上並沒有提到 trade 物件如何生成,最終導致無法撤單。

可能的後果 (以撤單為例)

如果沒撤單會造成保證金無法利用,或是無法改單而產生虧損。

建議解決方式 (擇一即可)

  1. remote/local 端紀錄 order 資訊,在登入的時候生成 trade/order 物件。
  2. 公開 https/restful 接口給其他人使用。
  3. 提供 trade 物件__init__方法,交由 client 自行記錄 id 等資訊。
  4. 實作其他 method 如 fetch_orders() 直接查詢當日所有交易。

p.s. 以類似 monkey patch 的方式當然是可以處理的,不過稍嫌麻煩。
p.s. 使用 monkey patch 可能會造成原本的 order 亦無法撤單,請勿嘗試。

module 'os' has no attribute 'add_dll_directory' in linux

Hi Yvictor,
I got error as below when I am trying to execute the example code.

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import shioaji as sj
  File "/home/sykuang/.local/lib/python3.8/site-packages/shioaji/__init__.py", line 22, in <module>
    from shioaji.shioaji import Shioaji
  File "/home/sykuang/.local/lib/python3.8/site-packages/shioaji/shioaji.py", line 7, in <module>
    from shioaji.backend.solace import SolaceAPI
  File "/home/sykuang/.local/lib/python3.8/site-packages/shioaji/backend/solace/__init__.py", line 1, in <module>
    from shioaji.backend.solace.quote import Quote
  File "shioaji/backend/solace/quote.pyx", line 4, in init shioaji.backend.solace.quote
  File "/home/sykuang/.local/lib/python3.8/site-packages/pysolace/__init__.py", line 18, in <module>
    inject_lib_path()
  File "/home/sykuang/.local/lib/python3.8/site-packages/pysolace/__init__.py", line 15, in inject_lib_path
    os.add_dll_directory(libs_path.as_posix())
AttributeError: module 'os' has no attribute 'add_dll_directory'
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

In pysolace/init.py

def inject_lib_path():
    import os
    import sys
    from pathlib import Path
    dir_path = Path(__file__).parent
    libs_path = dir_path.joinpath('.libs')
    os.environ["PATH"] = ";".join(
        [p for p in [os.environ.get("PATH", ""), libs_path.as_posix()] if p]
    )
    os.environ["LD_LIBRARY_PATH"] = ";".join(
        [p for p in [os.environ.get("LD_LIBRARY_PATH", ""),
                     libs_path.as_posix()] if p]
    )
    if sys.version_info.major == 3 and sys.version_info.minor >= 8:
        os.add_dll_directory(libs_path.as_posix())

You should add an os check for avoiding using add_dll_directory in Linux. I think add_dll_directory is for M$ windows.

歷史資料的成交明細有誤?

例如範例中:
ticks = api.ticks(api.Contracts.Stocks["2330"], "2020-03-04")
結果印出來的bid_price、ask_price、ask_volume、bid_volume均為0
我抓近期的資料也是一樣,
跟看盤軟體顯示的資料都有出入
還麻煩解惑,謝謝。

希望能增加macosx版本的wheel檔

  • OS 版本: macOS Catalina 10.15.5
  • Python版本: 3.6.10

安裝的時候撞到 'ERROR: No matching distribution found for shioaji==0.2.1.dev9'

截圖 2020-06-16 下午2 15 17

查了一下發現應該是沒有打包macosx版本的wheel

截圖 2020-06-16 下午2 17 28

'Shioaji' object has no attribute 'fut_account'

在docker環境下的 0.0.6.dev6 可以運行
但你們最新release的版本 0.1.1.dev0

這個是event_callback訊息

Response Code: 0 | Event Code: 0 | Info: host '203.66.91.161:80', IP 203.66.91.161:80 (host 1 of 1) (host connection attempt 1 of 1) (total connection attempt 1 of 1) | Event: Session
up

就會出現以下錯誤

Unexpected error: (<class 'AttributeError'>, AttributeError("'Shioaji' object has no attribute 'fut_account'",), <traceback object at 0x7fccc408f308>)

It seems that it's not friendly for TXO in Quote functions.

The APIs are friendly for Stocks and Futures, but not for Options.
I use the APIs to do Option quoting and encounter the error response "Max Num Subscriptions Exceeded".
I think that "Is there a method to subscript the big title like "TXO201904" or "TXO201904W4" which tag does not include the details (like TXO201904W4C10100,TXO201904W4P10100,TXO201904W4C10200,TXO201904W4P10200)?"
Thanks.

關於list_position function

請問禮拜六主機維護嗎,抓不到未平倉資訊;

另外看API ,get_account_openposition function這個之後會拿掉;
但是list_position取得的資訊無法得知未平倉商品合約月份(code、cond、direction、pnl、price、quantity、yd_quantity) ,
這會導致無法判斷是否到了換倉日而該換倉(也許商品已經是在次月)
請確認,謝謝!

Win10-64bit , python3.6.5, pip install shioaji error

Win10-64bit, python3.6.5,
c:> pip install shioaji
ERROR: Could not find a version that satisfies the requirement shioaji (from versions: none)
ERROR: No matching distribution found for shioaji

用pip安裝別的套件正常。

api.update_status()出現問題

windows 10
python 3.6.3 x64

api.update_status() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "d:\ide\workspace_python\xxx\lib\site-packages\shioaji\shioaji.py", line 330, in update_status self._api.update_status() File "shioaji\backend\http\main.pyx", line 117, in shioaji.backend.http.main.HttpApi.update_status File "shioaji\backend\http\order.pyx", line 104, in shioaji.backend.http.order.update_status File "shioaji\backend\http\stock\order.pyx", line 259, in shioaji.backend.http.stock.order.query_stock_order File "shioaji\backend\http\stock\order.pyx", line 240, in shioaji.backend.http.stock.order._query_stock_order AttributeError: 'NoneType' object has no attribute 'broker_id'

api.active_ca()問題

api.active_ca(r'D:\Program Files\eleader\Cert\SinoPac.pfx','xxxxxx','myID')
只要密碼正確,ID隨便打都會顯示
Ca Initial Done. 0
應該是沒確認到憑證內id?

Callback 回傳 Tick 資料有問題

爬資料幾個月來第一次發生, len(TickType|DiffType)=20, len(其他)=19, 會導致 dict 不能直接給 pd 丟 dataframe (其實更在意的是資料品質是否有問題)

--- cut ---
L/TFE/MXFC0 {"Amount": [11795.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0, 23584.0], "AmountSum": [1674890.0, 1698474.0, 1722058.0, 1745642.0, 1769226.0, 1792810.0, 1816394.0, 1839978.0, 1863562.0, 1887146.0, 1910730.0, 1934314.0, 1957898.0, 1981482.0, 2005066.0, 2028650.0, 2052234.0, 2075818.0, 2099402.0], "AvgPrice": [11795.0, 11794.958333333334, 11794.917808219177, 11794.878378378378, 11794.84, 11794.802631578947, 11794.766233766233, 11794.73076923077, 11794.696202531646, 11794.6625, 11794.62962962963, 11794.59756097561, 11794.56626506024, 11794.535714285714, 11794.505882352942, 11794.476744186046, 11794.448275862069, 11794.420454545454, 11794.393258426966], "Close": [11795.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0, 11792.0], "Code": "MXFC0", "Date": "2020/01/30", "DiffPrice": [-300.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0, -303.0], "DiffRate": [-2.4803637866887143, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015, -2.5051674245556015], "DiffType": [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "High": [11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0, 11795.0], "Low": [11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0, 11764.0], "Open": 11795.0, "TargetKindPrice": 12118.71, "TickType": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "Time": "08:45:00.105000", "TradeAskVolSum": 39, "TradeBidVolSum": 149, "VolSum": [142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178], "Volume": [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]}
--- cut ---

只是subscribe, 就出現 AttributeError: 'NoneType' object has no attribute 'code'

Log:

~/python$ ./sub.py
Response Code: 0 | Event Code: 0 | Info: host '203.66.91.161:80', IP 203.66.91.161:80 (host 1 of 1) (host connection attempt 1 of 1) (total connection attempt 1 of 1) | Event: Session up
Ca Initial Done.
Traceback (most recent call last):
File "./sub.py", line 13, in
api.quote.subscribe(api.Contracts.Stocks["2614"], quote_type=sj.constant.QuoteType.Tick)
File "shioaji/backend/solace/api.pyx", line 658, in shioaji.backend.solace.api.SolaceAPI.subscribe
File "shioaji/backend/solace/api.pyx", line 39, in shioaji.backend.solace.api.contract2topic
AttributeError: 'NoneType' object has no attribute 'code'
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

只有照sample code(login的部分正確確) 做以上的subscribe:
api.quote.subscribe(api.Contracts.Stocks["2614"], quote_type=sj.constant.QuoteType.Tick)

環境:
ubuntu 16.04
python3 3.5.2

API 文件修改 (action) 與命名

  1. api.OrderProps.Future.action.Buy 以及 api.OrderProps.Future.action.Sell 似乎分別改成了 "Buy""Sell",而不是原本字串 "B""S"。這個和 doc string 描述的不一致。在 limit_order 舉例的部分:
    sample_limit_order = api.LimitOrder('B', 9700, 5)
    sample_limit_order
    LimitOrder(action='B', order_type='ROD', price=9700, quantity=5)

現在也不能使用 "B""S" 作為 api.LimitOrder 的參數了。


  1. api.OrderProps.Future 這個命名指的應該是期貨? 所以應該是 api.OrderProps.Futures ?希望能夠確認一下,謝謝。

got UnboundLocalError when place_order

操作
trade = api.place_order(code, new_order)

得到下面的錯誤, 會是什麼問題呢?
`
File "shioaji\backend\utils.pyx", line 95, in shioaji.backend.utils.auth.wrapper_auth
File "shioaji\backend\utils.pyx", line 31, in shioaji.backend.utils.record.wrapper_record
File "shioaji\backend\http\main.pyx", line 58, in shioaji.backend.http.main.HttpApi.place_order
File "shioaji\backend\http\order.pyx", line 76, in shioaji.backend.http.order.place_order

UnboundLocalError: local variable 'resp' referenced before assignment
`

0.0.6.dev3 login 失敗

0.0.5dev7 正常 login 沒問題
0.0.6.dev3
login 之後遇到這個

~/venv/shioaji/lib/python3.7/site-packages/shioaji/shioaji.py in login(self, person_id, passwd)                                                   
     79         if self._socket:
     80             self._socket.login(person_id, passwd, self.quote)
---> 81         stock_account, future_account = self._http.login(person_id, passwd)
    

shioaji/backend/utils.pyx in shioaji.backend.utils.subscribe.wrapper_check()                                                                      

shioaji/backend/http/main.pyx in shioaji.backend.http.main.HttpApi.login()                                                                        

shioaji/backend/http/client.pyx in shioaji.backend.http.client.Client.login()                                                                     

IndexError: list index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.