All Projects → ghodsizadeh → Tehran Stocks

ghodsizadeh / Tehran Stocks

Licence: mit
A python package to access tsetmc data

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tehran Stocks

Shape Detection
🟣 Object detection of abstract shapes with neural networks
Stars: ✭ 170 (-39.72%)
Mutual labels:  jupyter-notebook, dataset
Trump Lies
Tutorial: Web scraping in Python with Beautiful Soup
Stars: ✭ 201 (-28.72%)
Mutual labels:  jupyter-notebook, dataset
Data Science Resources
👨🏽‍🏫You can learn about what data science is and why it's important in today's modern world. Are you interested in data science?🔋
Stars: ✭ 171 (-39.36%)
Mutual labels:  jupyter-notebook, dataset
Xianglong
资产配置方案
Stars: ✭ 158 (-43.97%)
Mutual labels:  jupyter-notebook, stock
Covid Chestxray Dataset
We are building an open database of COVID-19 cases with chest X-ray or CT images.
Stars: ✭ 2,759 (+878.37%)
Mutual labels:  jupyter-notebook, dataset
Motion Sense
MotionSense Dataset for Human Activity and Attribute Recognition ( time-series data generated by smartphone's sensors: accelerometer and gyroscope)
Stars: ✭ 159 (-43.62%)
Mutual labels:  jupyter-notebook, dataset
Fifa18 All Player Statistics
A complete catalog of all the players in Fifa 18 and their complete statistics.
Stars: ✭ 185 (-34.4%)
Mutual labels:  jupyter-notebook, dataset
Coronawatchnl
Numbers concerning COVID-19 disease cases in The Netherlands by RIVM, LCPS, NICE, ECML, and Rijksoverheid.
Stars: ✭ 135 (-52.13%)
Mutual labels:  jupyter-notebook, dataset
Datasets
source{d} datasets ("big code") for source code analysis and machine learning on source code
Stars: ✭ 231 (-18.09%)
Mutual labels:  jupyter-notebook, dataset
Weatherbench
A benchmark dataset for data-driven weather forecasting
Stars: ✭ 227 (-19.5%)
Mutual labels:  jupyter-notebook, dataset
Lacmus
Lacmus is a cross-platform application that helps to find people who are lost in the forest using computer vision and neural networks.
Stars: ✭ 142 (-49.65%)
Mutual labels:  jupyter-notebook, dataset
Dataset Api
The ApolloScape Open Dataset for Autonomous Driving and its Application.
Stars: ✭ 260 (-7.8%)
Mutual labels:  jupyter-notebook, dataset
Gossiping Chinese Corpus
PTT 八卦版問答中文語料
Stars: ✭ 137 (-51.42%)
Mutual labels:  jupyter-notebook, dataset
Cifar 10.1
Release of CIFAR-10.1, a new test set for CIFAR-10.
Stars: ✭ 166 (-41.13%)
Mutual labels:  jupyter-notebook, dataset
Datasets
🎁 3,000,000+ Unsplash images made available for research and machine learning
Stars: ✭ 1,805 (+540.07%)
Mutual labels:  jupyter-notebook, dataset
Alpha Mind
quantitative security portfolio analysis. The analysis pipeline including data storage abstraction, alpha calculation, ML based alpha combining and portfolio calculation.
Stars: ✭ 171 (-39.36%)
Mutual labels:  jupyter-notebook, stock
Know Your Intent
State of the Art results in Intent Classification using Sematic Hashing for three datasets: AskUbuntu, Chatbot and WebApplication.
Stars: ✭ 116 (-58.87%)
Mutual labels:  jupyter-notebook, dataset
Contactpose
Large dataset of hand-object contact, hand- and object-pose, and 2.9 M RGB-D grasp images.
Stars: ✭ 129 (-54.26%)
Mutual labels:  jupyter-notebook, dataset
Covid19za
Coronavirus COVID-19 (2019-nCoV) Data Repository and Dashboard for South Africa
Stars: ✭ 208 (-26.24%)
Mutual labels:  jupyter-notebook, dataset
Taco
🌮 Trash Annotations in Context Dataset Toolkit
Stars: ✭ 243 (-13.83%)
Mutual labels:  jupyter-notebook, dataset

Tehran Stock Market

made-with-python PyPI - Downloads PyPI version Code style: black

A python package that helps to access TSETMC stock price history, Using OOP Interface

Features

  • Download All stocks prices
  • Download prices from a group (i.e ETFs or cars, etc.)
  • Download Price history of one specific Stock
  • After first setup available offline.
  • CommandLine Interface
  • Export data to csv, excel or Stata(dta)
  • Compatible with sqlalchemy
  • Compatible with PANDAS
  • Based on light sqlite

0 - Install

pip install tehran_stocks

1- Initialization

For first use you need initialize the database

1-1 Command line

ts-get init  # Set up to sqlite database

1-2 Python

import tehran_stocks
# On first import package initialize itself

During initialization you will prompt for downloading all prices. if you answer yes it will download all prices, otherwise you can download data

2- Download and Update prices

2-1 Command line

ts-get update # update  all price , or download all if no price exist
ts-get  group 34 ## 34 is the code for car's group.
ts-get get_groups ## get group name and group codes

2-2 Python

from tehran_stocks import get_all_price, Stocks, update_group

get_all_price() # download and(or) update all prices

update_group(34) #download and(or) update Stocks in groupCode = 34 (Cars)

Stocks.get_group() # to see list of group codes

3- Access Data

To access data you can use Stocks which is an customized sqlalchemy object, which helps you to find prices on an easy way.

3-1 Search Stocks

from tehran_stocks import Stocks, db

# You can use query to find stocks
stock = Stocks.query.filter_by(name='كگل').first() #find by symbol(نماد)

stock = Stocks.query.filter_by(code='35700344742885862').first() # find by code on tsetmc url

stock = Stocks.query.filter(Stocks.title.like('%گل گهر%')).first() # Search by title

stock_list = Stocks.query.filter_by(group_code =34).all() # find all Stocks in Khodro

stock_list = Stocks.query.filter(Stocks.group_code.in_([13,34])).all() # all stocks in khodro and felezat


## (Advanced)or run sql query using orm or raw sql
db.session.query(Stocks.group_code, Stocks.group_name).group_by(Stocks.group_code).all()

db.session.execute('select group_code , group_name from stocks group by group_name').fetchall()

Now easily access stock price and do whatever you want with pandas dataframes:

# use data as a pandas dataframe
>>> stock.df #
      id               code        ticker  dtyyyymmdd    first     high      low    close        value      vol  openint per     open     last       date
0  22491  35700344742885862  Gol-E-Gohar.    20040829  12000.0  12021.0  12000.0  12000.0  18841605000  1570000     2708   D  12000.0  12000.0 2004-08-29

>>> stock.summary()
Start date: 20040829
End date: 20190714
Total days: 2987

>>> stock.update()
# update stock price history

# Export to your preferred format
>>> stock.df.to_csv('price.csv')
>>> stock.df.to_excel('price.xlsx')
>>> stock.df.to_stata('price.dta')

Todo

  • [x] Create Database
  • [x] Download Data
  • [x] CommandLine Support
  • [x] Jalali Support

Donation❤️

If you like this package you can buy me a cup of coffee ☕️.

You can pay using آپ Application by scanning following qrcode in the application or entering code 95656781:

NeshanPardakht

Or donate using IDPAY

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].