qmlpython
Mixed programming based on QtQuick and Python
主要展示Qt與Python的結合
- 主要依賴于pyotherside第三方庫
- 結合Python3.0
- 結合QtQuick插件式開發
- 結合第三方Python功能庫進行功能開發
展示效果
全球數字貨幣
A股上市公司一覽
某股日線數據
新股上市一覽
全球數字貨幣交易所
展示代碼
///獲取金融相關數據
function getCoinlist(functionName,pageId){
loading = true;
var functionId = 'qrc_example.'+functionName;
py.call(functionId, '', function(result) {
// Load the received data into the list model
//console.log("pageId"+pageId+ "result: " + result.length);
loading = false;
try{
var obj = JSON.parse(result);
if(typeof obj ==='object'){
for(var i in obj) {
//if(obj[i].cn_name == null)continue;
pageId.myModel.append(obj[i]);
}
}
}
catch(e){
console.log("============error=====");
aniId.visible = true;
aniId.setTooltips("接口出錯啦............");
aniId.start();
}
});
}
# Python 代碼 注意其中的token替換為自己的
import pyotherside
import os.path
import sys
import tushare as ts
from io import StringIO
print('Hello from module!')
print(sys.path)
print('='*30)
def getstockbase():
print('start=====SSE=========')
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df = pro.stock_basic(exchange_id='SSE', list_status='L', fields='ts_code,symbol, name,area,industry,fullname, enname, market,exchange, curr_type, list_status, list_date, delist_date,is_hs')
return (df.to_json(orient='index'))
def getcoinlist():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df1 = pro.coinlist(start_date='20080101', end_date='20141231')
return (df1.to_json(orient='index'))
def coinexchanges():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df1 = pro.coinexchanges(area_code='us')
df1 = df1.sort('pairs', ascending=False)
return (df1.to_json(orient='index'))
def dailyK():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df = pro.daily(ts_code='000001.SZ', start_date='20180701', end_date='20190518')
return (df.to_json(orient='index'))
def new_share():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df = pro.new_share(start_date='20180901', end_date='20190618')
return (df.to_json(orient='index'))
def coinexchanges():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df = pro.coinexchanges()
return (df.to_json(orient='index'))
def jinse():
ts.set_token('e53a32fc435f5fc25ab450333bda9d545856f1dfa1afc3d11699edcc')
pro = ts.pro_api()
df = pro.jinse(start_date='2019-05-17 16:00:00', end_date='2019-06-04 18:00:00', \
fields='title, type, datetime')
return (df.to_json(orient='index'))
print('='*30)
憧憬
- 實現國內針對QtQuick與Python結合
- 擴大QtQuick在Python領域的使用
- 讓Python庫成為Qt的一個強力的類庫
貢獻
- 源碼入口
- 寒山-居士
- toby520
- cms多多指教
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
