-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from mahs4d/bugfix/old-base-url
Change `_core` base urls to `old.tsetmc.com`
- Loading branch information
Showing
18 changed files
with
496 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(The MIT License) | ||
|
||
Copyright 2022 Mahdi Sadeghi <[email protected]> | ||
Copyright 2023 Mahdi Sadeghi <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,25 @@ You can install this library using the following command: | |
|
||
`pip install tsetmc-api` | ||
|
||
## Examples | ||
|
||
You can find examples of using each component in `examples` directory. | ||
|
||
| Component | Example File | | ||
|--------------|-------------------------------------------------------------| | ||
| Symbol | [symbol_example.py](examples/symbol_example.py) | | ||
| Market Watch | [market_watch_example.py](examples/market_watch_example.py) | | ||
| Day Details | [day_details_example.py](examples/day_details_example.py) | | ||
| Market Map | [market_map_example.py](examples/market_map_example.py) | | ||
| Group | [group_example.py](examples/group_example.py) | | ||
|
||
## Usage | ||
|
||
- **symbol:** working with main symbol page and live data (e.g. [this page](http://www.tsetmc.com/loader.aspx?ParTree=151311&i=43362635835198978)) | ||
- **symbol:** working with main symbol page and live data ( | ||
e.g. [this page](http://www.tsetmc.com/loader.aspx?ParTree=151311&i=43362635835198978)) | ||
- **market_watch:** getting data visible from [market watch page](http://www.tsetmc.com/Loader.aspx?ParTree=15131F) | ||
- **day_details:** working with details of a symbol in a single day of history (e.g. [this page](http://cdn.tsetmc.com/History/43362635835198978/20221029)) | ||
- **day_details:** working with details of a symbol in a single day of history ( | ||
e.g. [this page](http://cdn.tsetmc.com/History/43362635835198978/20221029)) | ||
- **market_map:** getting data visible in [market map page](http://main.tsetmc.com/marketmap) | ||
- **group:** getting list of available symbol groups | ||
|
||
|
@@ -40,6 +54,15 @@ Group component currently only has one function (`get_all_groups`) which returns | |
|
||
Tsetmc sometimes returns 403 and you should retry. | ||
|
||
### TODO | ||
|
||
[ ] Migrate `symbol` component to use new tsetmc. | ||
[ ] Migrate `market_watch` component to use new tsetmc. | ||
[x] Migrate `day_details` component to use new tsetmc. | ||
[x] Migrate `market_map` component to use new tsetmc. | ||
[x] Migrate `group` component to use new tsetmc. | ||
|
||
## Support and Donation | ||
|
||
If this repository helped you, please support it by giving a star (:star:). | ||
For donation please contact me at [[email protected]](mailto:[email protected]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from jdatetime import date as jdate | ||
|
||
from tsetmc_api.day_details import DayDetails | ||
|
||
# تغییرات نماد در یک روز | ||
day_details = DayDetails(symbol_id='14079693677610396', date=jdate(1402, 3, 1)) | ||
|
||
# قیمتهای نهایی | ||
price_overview = day_details.get_price_overview() | ||
|
||
# تغییرات قیمتی | ||
price_data = day_details.get_price_data() | ||
|
||
# تغییرات صفهای خرید و فروش | ||
orderbook_data = day_details.get_orderbook_data() | ||
|
||
# معاملات | ||
trades_data = day_details.get_trades_data() | ||
|
||
# بیشترین و کمترین قیمت روز | ||
thresholds_data = day_details.get_thresholds_data() | ||
|
||
# تغییرات سهامداران عمده | ||
old_shareholders, new_shareholders = day_details.get_shareholders_data() | ||
|
||
# چارت یک سهامدار | ||
old_shareholders[0].get_chart_data() | ||
|
||
# سهام یک سهامدار عمده | ||
old_shareholders[0].shareholder.get_portfolio_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from tsetmc_api.group import Group | ||
|
||
# اطلاعات گروهها | ||
all_groups = Group.get_all_groups() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from tsetmc_api.market_map import MarketMap, MapType | ||
|
||
# نقشهی بازار | ||
market_map = MarketMap() | ||
|
||
# گرفتن نقشهی بازار بر اساس ارزش | ||
map_by_value = market_map.get_market_map_data(map_type=MapType.MARKET_VALUE) | ||
|
||
# گرفتن نقشهی بازار بر اساس حجم | ||
map_by_volume = market_map.get_market_map_data(map_type=MapType.MARKET_VOLUME) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tsetmc_api.market_watch import MarketWatch | ||
|
||
# دیدهبان بازار | ||
# توجه کنید که این اطلاعات از صفحهی دیدهبان بازاره و مثلا سابقهی اینجا با اون سابقهای که توی صفحه | ||
# نماد میبینیم فرق داره. اونا توی پکیج symbol قرار دارند. | ||
market_watch = MarketWatch() | ||
|
||
# اطلاعات قیمتی | ||
price_data = market_watch.get_price_data() | ||
|
||
# اطلاعات آماری به صورت خام | ||
raw_stats_data = market_watch.get_raw_stats_data() | ||
|
||
# اطلاعات آماری به صورت parse شده | ||
stats_data = market_watch.get_stats_data() | ||
|
||
# اطلاعات حقیقی حقوقی | ||
traders_type_data = market_watch.get_traders_type_data() | ||
|
||
# اطلاعات سابقه | ||
daily_history_data = market_watch.get_daily_history_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from tsetmc_api.symbol import Symbol | ||
|
||
# دیدن مشخصات یک نماد (نماد آسیاتک) | ||
# این عددی که به عنوان symbol_id بهش میدیم، از تیکهی آخر url صفحهی آسیاتک توی سایت برداشته شده | ||
# مثلا آدرس آسیاتک توی tsetmc اینه: http://main.tsetmc.com/InstInfo/14079693677610396 | ||
# اون تیکه آخرش میشه symbol_id | ||
symbol = Symbol(symbol_id='14079693677610396') | ||
|
||
# اطلاعات قیمتی داخل در یک نگاه | ||
price_overview = symbol.get_price_overview() | ||
|
||
# چارت داخل در یک نگاه | ||
intraday_price_chart_data = symbol.get_intraday_price_chart_data() | ||
|
||
# پیام ناظر | ||
supervisor_message_data = symbol.get_supervisor_messages_data() | ||
|
||
# اطلاعیه | ||
notification_data = symbol.get_notifications_data() | ||
|
||
# تغییر وضعیت | ||
state_changes_data = symbol.get_state_changes_data() | ||
|
||
# سابقه | ||
daily_history = symbol.get_daily_history() | ||
|
||
# شناسه | ||
id_details = symbol.get_id_details() | ||
|
||
# حقیقی حقوقی | ||
traders_type_history = symbol.get_traders_type_history() | ||
|
||
# سهامداران | ||
shareholders = symbol.get_shareholders_data() | ||
|
||
# چارتی که وقتی روی یک سهامدار کلیک میکنیم میده | ||
shareholder_chart_data = shareholders[0].get_chart_data() | ||
|
||
# سایر سهام سهامدار عمده | ||
shareholder_portfolio_data = shareholders[0].shareholder.get_portfolio_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.