首页 股吧 正文

「众成证券」怎样用 Python 写一个股票自动交易的程序

2024-09-07 00:09:10 50
admin

怎樣用 Python 寫一箇股票自動交易的程序

股票自動交易助手提供了一箇 Python 自動下單接口,參考代碼

#股票自動交易助手?Python?自動下單使用?例子

#把此腳本和?StockOrderApi.py?Order.dll?放到你自己編寫的腳本同一目錄

from?StockOrderApi?import?*

#買入測試

#Buy(u600000?,?100,?0,?1,?0)

#賣出測試,是持倉股纔會有動作

#Sell(u000100?,?100,?0,?1,?0)

#賬戶信息

print(股票自動交易接口測試)

print(賬戶信息)

print(--------------------------------)

arrAccountInfo?=?[總資產,?可用資金,?持倉總市值,?總盈利金額,?持倉數量];

for?i?in?range(0,?len(arrAccountInfo)):

?value?=?GetAccountInfo(?u??,?i,?0)

?print?(%s?%f?%(arrAccountInfo[i],?value))

print(--------------------------------)

print(?)

print(股票持倉)

print(--------------------------------)

#取出所有的持倉股票代碼,結果以?','隔開的

allStockCode?=?GetAllPositionCode(0)

allStockCodeArray?=?allStockCode.split(',')

for?i?in?range(0,?len(allStockCodeArray)):

?vol?=?GetPosInfo(?allStockCodeArray[i]??,?0?,?0)

?changeP?=?GetPosInfo(?allStockCodeArray[i]??,?4?,?0)

?print?(%s?%d?%.2f%%%(allStockCodeArray[i],?vol,?changeP))

print(--------------------------------)

如何用spass添加趨勢線方程

選擇Graph--Scatter/dot 在新的對話框中選擇simple scatter,單擊define。 將兩個變量分別拖到X axis和Y axis。單擊OK。 圖形生成了。 雙擊圖形,出來一箇新的窗體。在這個窗體的圖形中,單擊任意一箇點,確保所有的點都被選中。 點擊菜單。

收藏
分享
海报
50