最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python的凈值數(shù)據(jù)接口調(diào)用示例分享

 更新時間:2016年03月15日 11:25:20   投稿:hebedich  
這篇文章主要介紹了Python的凈值數(shù)據(jù)接口調(diào)用示例分享的相關(guān)資料,需要的朋友可以參考下

代碼描述:基于Python的凈值數(shù)據(jù)接口調(diào)用代碼實(shí)例
關(guān)聯(lián)數(shù)據(jù):凈值數(shù)據(jù)
接口地址:https://www.juhe.cn/docs/api/id/25

#!/usr/bin/python
# -*- coding: utf-8 -*-
import json, urllib
from urllib import urlencode

#----------------------------------
# 凈值數(shù)據(jù)調(diào)用示例代碼 - 聚合數(shù)據(jù)
# 在線接口文檔:http://www.juhe.cn/docs/25
#----------------------------------

def main():

  #配置您申請的APPKey
  appkey = "*********************"

  #1.全部開放基金
  request1(appkey,"GET")

  #2.股票型基金
  request2(appkey,"GET")

  #3.普通債券型基金
  request3(appkey,"GET")

  #4.貨幣型基金
  request4(appkey,"GET")

  #5.封閉型基金
  request5(appkey,"GET")
 
  #6.創(chuàng)新封基
  request6(appkey,"GET")

  #7.LOF
  request7(appkey,"GET")

  #8.ETF
  request8(appkey,"GET")

  #9.QDII
  request9(appkey,"GET")

#全部開放基金
def request1(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/all"
  params = {
    "key" : appkey, #APPKEY值

  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#股票型基金
def request2(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/stock"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#普通債券型基金
def request3(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/bond"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#貨幣型基金
def request4(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/monet"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#封閉型基金
def request5(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/close"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#創(chuàng)新封基
def request6(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/innov"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#LOF
def request7(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/lof"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#ETF
def request8(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/etf"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"
 
#QDII
def request9(appkey, m="GET"):
  url = "http://web.juhe.cn:8080/fund/netdata/qdii"
  params = {
    "key" : appkey, #APPKEY值
 
  }
  params = urlencode(params)
  if m =="GET":
    f = urllib.urlopen("%s?%s" % (url, params))
  else:
    f = urllib.urlopen(url, params)
 
  content = f.read()
  res = json.loads(content)
  if res:
    error_code = res["error_code"]
    if error_code == 0:
      #成功請求
      print res["result"]
    else:
      print "%s:%s" % (res["error_code"],res["reason"])
  else:
    print "request api error"

if __name__ == '__main__':
  main()

相關(guān)文章

  • 基于Python實(shí)現(xiàn)人工智能算法的方法詳解

    基于Python實(shí)現(xiàn)人工智能算法的方法詳解

    Python已經(jīng)成為了機(jī)器學(xué)習(xí)領(lǐng)域最受歡迎的編程語言之一,Python的簡潔性和易用性使其成為了開發(fā)人員和數(shù)據(jù)科學(xué)家的首選語言,在本文中,我們將探討如何使用Python實(shí)現(xiàn)人工智能算法,感興趣的小伙伴跟著小編一起來探討吧
    2023-06-06
  • Python辦公自動化SFTP詳解

    Python辦公自動化SFTP詳解

    這篇文章主要介紹了Python辦公自動化SFTP詳解,sftp和ftp的區(qū)別在安全通道,使用的協(xié)議,鏈接方式,安全性等方面都有不同,更多相關(guān)內(nèi)容需要的小伙伴可以參考一下
    2022-08-08
  • django ListView的使用 ListView中獲取url中的參數(shù)值方式

    django ListView的使用 ListView中獲取url中的參數(shù)值方式

    這篇文章主要介紹了django ListView的使用 ListView中獲取url中的參數(shù)值方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-03-03
  • Python超詳細(xì)分步解析隨機(jī)漫步

    Python超詳細(xì)分步解析隨機(jī)漫步

    隨機(jī)游走(random walk)也稱隨機(jī)漫步,隨機(jī)行走等是指基于過去的表現(xiàn),無法預(yù)測將來的發(fā)展步驟和方向。核心是指任何無規(guī)則行走者所帶的守恒量都各自對應(yīng)著一個擴(kuò)散運(yùn)輸定律,接近布朗運(yùn)動,現(xiàn)階段主要應(yīng)用于互聯(lián)網(wǎng)鏈接分析及金融股票市場中
    2022-03-03
  • Python筆記之觀察者模式

    Python筆記之觀察者模式

    這篇文章主要為大家詳細(xì)介紹了Python筆記之觀察者模式,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-11-11
  • python矩陣運(yùn)算,轉(zhuǎn)置,逆運(yùn)算,共軛矩陣實(shí)例

    python矩陣運(yùn)算,轉(zhuǎn)置,逆運(yùn)算,共軛矩陣實(shí)例

    這篇文章主要介紹了python矩陣運(yùn)算,轉(zhuǎn)置,逆運(yùn)算,共軛矩陣實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-05-05
  • IPython?8.0?Python?命令行交互工具

    IPython?8.0?Python?命令行交互工具

    這篇文章主要介紹了IPython?8.0?Python?命令行交互工具,IPython?是?Python?的原生交互式?shell?的增強(qiáng)版,可以完成許多不同尋常的任務(wù),下面我們就拉看看文章具體的介紹內(nèi)容吧
    2022-01-01
  • 淺談python opencv對圖像顏色通道進(jìn)行加減操作溢出

    淺談python opencv對圖像顏色通道進(jìn)行加減操作溢出

    這篇文章主要介紹了淺談python opencv對圖像顏色通道進(jìn)行加減操作溢出,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-06-06
  • python中pytest收集用例規(guī)則與運(yùn)行指定用例詳解

    python中pytest收集用例規(guī)則與運(yùn)行指定用例詳解

    這篇文章主要介紹了python中pytest收集用例規(guī)則與運(yùn)行指定用例詳解,天會講解一下pytest是如何收集我們寫好的用例?我們又有哪些方式來運(yùn)行單個用例或者批量運(yùn)行用例呢,需要的朋友可以參考下
    2019-06-06
  • python利用 pytesseract快速識別提取圖片中的文字((圖片識別)

    python利用 pytesseract快速識別提取圖片中的文字((圖片識別)

    本文介紹了tesseract的python調(diào)用,也就是pytesseract庫,其中還有一些其他的內(nèi)容并沒有涉及,僅涉及到了圖片提取文字,如果你對其感興趣,可以深入探索一下,也希望能和我探討一下
    2022-11-11

最新評論

万源市| 曲靖市| 聂荣县| 大理市| 贺兰县| 开远市| 揭东县| 陵川县| 耒阳市| 嘉兴市| 永仁县| 舟山市| 邹城市| 辽宁省| 龙州县| 图木舒克市| 辛集市| 安溪县| 景德镇市| 延庆县| 彰武县| 昌乐县| 咸宁市| 荣昌县| 石屏县| 龙山县| 东兰县| 错那县| 巨野县| 灌云县| 哈尔滨市| 东阳市| 宽城| 甘肃省| 富顺县| 平湖市| 彭阳县| 太和县| 桃源县| 石林| 铁岭县|