Giter VIP home page Giter VIP logo

stock's Introduction

Welcome to Stock

Requirements | Installation | Quick Start | Examples

台灣股市資料收集及分析系統。

stock 目前可以從 TWSE 網站爬取台灣個股每天的量價資訊,以供使用者做後續的分析處理。

Requirements

  • Python 3.x
  • mongoDB
  • requests >= 2.24.0 (python module)
  • pymongo >= 3.11.0 (python module)
  • lxml >= 4.6.1 (python module)

Installation

你可以直接執行 setup.py 來安裝此 package。

> python setup.py install

Quick Start

基本個股資訊抓取方法,stock 會把你需要的個股資訊都從網站上存取下來,並儲存在自己建立的 database。

Stock class 提供三種抓取個股資訊的方法,分別是:

  • 抓取個股某日資訊 (getInfo(day, month, year, info))
  • 抓取個股某月資訊 (getInfo(month, year, info))
  • 抓取個股某季資訊 (getInfo(quarter, year, info))

Note: quarter 要給的參數是 "1st", "2nd", "3rd", "4th"

這些抓取資訊的 functions 都叫 getInfo,差別在於輸入的參數。其中有項參數 info 是用來決定要抓取個股的什麼資訊。目前能夠使用 getInfo 獲取的資訊有:

  • 日期 (date)
  • 每日成交股數 (trading_vol)
  • 每日成交金額 (turnover)
  • 每日開盤價 (opening)
  • 每日收盤價 (closing)
  • 每日最高價 (hi)
  • 每日最低價 (lo)
  • 每日成交量 (transactions)

下面程式碼示範如何使用 StockgetInfo function 獲得個股每日最高價的資訊。

from stock import stock

s = stock("2330")
s.getInfo(8, 2021, "hi") # 抓取 2021 年 8 月的每日最高價

另外也可以參考 Examples 內的一些範例程式。

stock's People

Contributors

jyun-neng 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.