Skip to main content

Get data of stock exchange thailand (SET)

Project description

Library สำหรับประมวลข้อมูลตลาดหุ้นไทย Stock Exchange of Thailand https://www.set.or.th และการจัดการ Portfolio

พื้นฐานที่ต้องการ

$ conda install -c conda-forge matplotlib

จาก https://anaconda.org/conda-forge/matplotlib

การติดตั้ง

$ pip install starfishX  หรือ  $ pip install starfishX --upgrade

หรือ

$ pip3 install starfishX --upgrade

Quantitative

  • sx.loadHistData(str|list,start="2018-01-01",end="2018-12-31") end ถ้าไม่ใส่คือวันที่ล่าสุด
  • df,k = sx.MonthlyReturn([str],"2016-01-01")
  • sx.linregressIndicator(basket,periodDay) int periodDay จำนวนวันล่าสุดที่จะใช้ใน Linear least-squares regression

ข้อมูลงบการเงินและข้อมูลตลาด

  • sx.commonsizeBS(str)

  • sx.commonsizeIS(str)

  • sx.getFinanceRatio(str|list) str,list ส่งค่าเป็น str จะ return ค่าย้อนหลังได้หลายปี หากส่งค่าเป็น array list จะ return แบบเปรียบเทียบ

  • sx.spiderCompare([str1,str2]) ใช้คู่กับ sx.getFinanceRatio และ list ความยาว 2 เท่านั้น

  • sx.getIncomeStatement(str)

  • sx.getIncomeStatementCompare(list)

  • sx.getBalanceSheet(str)

  • sx.getBalanceSheetCompare(list)

  • sx.getMemberOfIndex("set50") SET50,SET100,sSET,SETCLMV,SETHD,SETTHSI,SETWB

  • sx.listStockInSector("kbank") สุ่มอะไรก็ได้ในกลุ่มอุตสาหกรรมนั้นๆ

  • sx.getFundamentalInSector("kbank") สุ่มอะไรก็ได้ในกลุ่มอุตสาหกรรมนั้นๆ

  • sx.findCASH("aot")

  • sx.listShareholders(str|list,csv="file.csv") csv สำหรับบันทึกข้อมูลเป็น csv

  • sx.listSecurities()

  • sx.findMarketCap(str|list)

  • sx.DuPontROE(str,int,firstLine=False) str Symbol ของหุ้นรายตัว int Year เป็นปีพ.ศ. เช่น 2562 หรือ 2561 firstLine True คือ SALE ใช้บรรทัดแรก แต่ถ้าเป็น False SALE จะใช้รายได้รวมทั้งหมด ถ้าไม่ใส่ปกติจะเป็น False

  • sx.InterestBearingDebt(str) str Symbol ของหุ้นรายตัว ใช้หาหนี้ที่มีคาดว่ามีภาระดอกเบี้ย

  • sx.DA(str) str Symbol ใช้หาค่าเสื่อมราคาและค่าตัดจำหน่าย

  • sx.morningstarGetfn(str,Indicates=sx.MStar) ดึงค่าปัจจัยพื้นฐานจาก morningstar str Symbol ของหุ้นรายตัว sx.MStar คือ ตัวคัดกรองที่ต้องการ เช่น ปันผลใช้ sx.MStar.Dividends , รายได้ใช้ sx.MStar.Revenue เป็นต้น จาก Cr.http://financials.morningstar.com

  • sx.marketview(indexMarket,start=year) str year ใช้ปีค.ศ. เช่น 2010-01-01 YYYY-MM-DD indexMarket Class เช่น sx.indexMarket.SET50

  • rp = sx.marketViewForeignTrade(indexMarket,start="2016-01-01") indexMarket ของต่างชาติซื้อขายมีเพียง SET และ mai เท่านั้น str year ใช้ปีค.ศ. เช่น 2010-01-01 YYYY-MM-DD

  • sx.AnomalyDetectionVolume(DataSet,contamination=0.01,viewplot=True) DataSet เป็น DataFrame ของปริมาณการซื้อขาย contamination ส่วนของสิ่งผิดปกติใน DataSet

ประเมินมูลค่าหุ้น

  • sx.getEVEBITDA(symbol,year) int Year เป็นปีพ.ศ. เช่น 2562 หรือ 2561

  • sx.analyseEVEBITDA(basket,yearstart,yearend) วิเคราะห์คุณภาพ EV/EBITDA

  • sx.DividendDiscountModel(symbol,year,k) int Year เป็นปีพ.ศ. เช่น 2562 หรือ 2561 k อัตราผลตอบแทนที่คาดหวัง

  • sx.thaibma(year,bondtype=sx.BondType.ThaiGovernmentBond10Year) strFormat ใช้ค.ศ. เช่น 2019-06-10 YYYY-MM-DD Cr.http://www.thaibma.or.th

  • sx.beta(str) str Symbol

  • sx.EarningYieldGap(indexMarket,bondtype,start=year) str year ใช้ปีค.ศ. เช่น 2010-01-01 YYYY-MM-DD

Optimization

  • sx.MarkowitzProcess(df,alias=symbols,random=5000)

ตัวอย่าง Data Type และอื่นๆ

  • list เช่น ["aot","ptt"]
  • str เช่น "aot"
  • sx.checkServices() เป็นการตรวจสอบการทำงานของ Server โดยภาพรวมว่า function ยังทำงานโดยปกติไหม

ตัวอย่างการใช้งาน

import starfishX as sx

print(sx.__version__)

sx.getBalanceSheet("aot")

ตัวอย่างการใช้งาน

import starfishX as sx

symbol = ["aot","ptt"]

df = sx.loadHistData(symbol,start="2018-01-01")

ตัวอย่างการใช้งาน

import starfishX as sx

symbols = ["ptt","cpf","mint","aav"]

df = sx.loadHistData(symbols,start="2018-01-01")

sx.MarkowitzProcess(df,alias=symbols,random=5000)

ติดต่อฉัน แจ้ง BUG แจ้ง Error ได้ที่

Facebook : https://www.facebook.com/Superstarman-1464755373546185/

Email : tapattan@จีเมล์ดอทคอม

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starfishX-0.155496.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

starfishX-0.155496-py3-none-any.whl (61.2 kB view details)

Uploaded Python 3

File details

Details for the file starfishX-0.155496.tar.gz.

File metadata

  • Download URL: starfishX-0.155496.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.2

File hashes

Hashes for starfishX-0.155496.tar.gz
Algorithm Hash digest
SHA256 91462487ea89986c780ed8a2da9f0da87225a971f51ca597fbb0f3204e097b27
MD5 1b4a9819bc5d56902191fb606d05844e
BLAKE2b-256 ca9762d89e1000a2be092685d624c5f1c0c307e1a90c688315a2339007939c13

See more details on using hashes here.

File details

Details for the file starfishX-0.155496-py3-none-any.whl.

File metadata

  • Download URL: starfishX-0.155496-py3-none-any.whl
  • Upload date:
  • Size: 61.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.2

File hashes

Hashes for starfishX-0.155496-py3-none-any.whl
Algorithm Hash digest
SHA256 ba66ea9e61d08961ab09e2eed0dd6aa9f8d64e9cae7d6e2e87c780ddc179129a
MD5 6f261ad58fff592d2643d4677e6af376
BLAKE2b-256 4e5485ba890f260df13c5fc0ee834e810dd4029214490386be1e984442250d90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page