Coder Social home page Coder Social logo

yuantaapi-python's Introduction

Yuanda Quote API using Python

Table of Contents

Introduction

  • 這是使用 Python 串接元大行情 API 的程式。
  • 這份程式碼修改自 這篇文章,請各位一定要去按個讚!

Features

  • 啟動程式後,會將行情資料記錄成 csv 檔。
    • 只要有撮合、五檔跳動皆會新增一筆資料。
  • 支援股票、期貨和選擇權商品。
  • 自動切換日夜盤。
  • 自動更新選擇權商品代碼。

Environment

  • OS: Windows 10 x64 1903
  • Python Version: 3.6 x86
    • 必須使用 x86 版本的 Python 才能正常運作。

Installation

  • 安裝元大行情 API,請參考 這篇文章
  • 安裝 Python 環境:
    • pip install -r requirements.txt

Usage

  • $ python quote.py [-h] [-v VERBOSE]
    • -h, --help - 顯示說明訊息。
    • -v, --verbose - 設定 Log 檔的 Logging Level,請參考 Severity Levels
    • --no-option - 選擇不要接收選擇權的行情

Port

  • 使用 80 或 443 為日盤的行情。
  • 使用 82 或 442 為夜盤的行情。

Columns Name

  • 關於行情資料欄位的名稱與解釋請參考 COLSNAME.md

Scripts

  • do_compress.py
    • 壓縮行情資料,建議使用 Bash 執行。
  • log_cls.py
    • 清除 ./Logs 下的紀錄檔。
  • quote.py
    • 接收行情資料的主程式。
  • retrieve_file.py
    • 從行情資料夾內提取目標商品的資料。
  • std_analysis.py
    • 分析行情價格標準差變動的相關資訊。
  • switch_battery_plan.py
    • 切換電腦的電源狀態。
  • utils.py
    • 系統相關程式庫。
  • ping.sh
    • 執行 Ping 元大行情主機的指令。
    • 必須使用 Bash 執行。

To-Do

  • 選擇權商品的部分並不算太完整,目前只有針對個人需求抓取台指的部分。

Security Issue

  • 元大 API 會在連接伺服器的時候自動產生一個 Logs\event.log 的檔案,會將使用者的帳密以明碼的方式寫入,程式執行結束時請務必手動刪除這個檔案。
    • 本系統會每隔五分鐘清除一次這個資料夾下的檔案
    • 也可以手動執行 log_cls.py 這個程式來清除

Reference

yuantaapi-python's People

Contributors

penut85420 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

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.