Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rochi88 committed Mar 4, 2024
1 parent 8bdd8d5 commit a2b7102
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 49 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,27 @@ Store(df).save()
#### Trading data
|Function|Params|Description|
|---|---|---|
|get_current_trade_data()|||
|get_dsex_data()|||
|get_current_trading_code()|||
|get_hist_data()|||
|get_basic_hist_data()|||
|get_close_price_data()|||
|get_current_trade_data()|symbol:str|get last stock price|
|get_dsex_data()|symbol:str|get dseX share price|
|get_current_trading_code()||get last stock codes|
|get_hist_data()|start:str, end:str|get historical stock price|
|get_basic_hist_data()|start:str, end:str, code:str|get historical stock price|
|get_close_price_data()|start:str, end:str, code:str|get stock close price|
|get_last_trade_price_data()|||
|get_cse_current_trade_data()|||

#### Trading news
|Function|Params|Description|
|---|---|---|
|get_agm_news()|||
|get_all_news()|||
|get_agm_news()||get stock agm declarations|
|get_all_news()|start:str, end:str, code:str|get dse news|

#### Market data
|Function|Params|Description|
|---|---|---|
|get_market_inf()|||
|get_latest_pe()|||
|get_market_inf_more_data()|||
|get_market_depth_data()|str|get_market_depth_data('ACI')|
|get_market_inf()||get stock market information|
|get_latest_pe()||get last stock P/E|
|get_market_inf_more_data()|start:str, end:str|get historical stock price|
|get_market_depth_data()|index:str|get_market_depth_data('ACI')|

### <a name="roadmap"></a> [TODO's and Road Map:](#contents)
- [x] refine logic for parameters
Expand Down
35 changes: 1 addition & 34 deletions bdshare/stock/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,37 +264,4 @@ def get_close_price_data(start=None, end=None, code='All Instrument'):

def get_last_trade_price_data():
df = pd.read_fwf('https://dsebd.org/datafile/quotes.txt', sep='\t', skiprows=4)
return df


def get_cse_current_trade_data(symbol=None):
"""
get last stock price.
:param symbol: str, Instrument symbol e.g.: 'ACI' or 'aci'
:return: dataframe
"""
try:
r = requests.get(vs.CSE_URL+vs.CSE_LSP_URL)
except Exception as e:
print(e)
soup = BeautifulSoup(r.text, 'html.parser')
quotes = [] # a list to store quotes
table = soup.find('table', attrs={'id': 'dataTable'})
for row in table.find_all('tr')[1:]:
cols = row.find_all('td')
quotes.append({'symbol': cols[1].text.strip().replace(",", ""),
'ltp': cols[2].text.strip().replace(",", ""),
'open': cols[3].text.strip().replace(",", ""),
'high': cols[4].text.strip().replace(",", ""),
'low': cols[5].text.strip().replace(",", ""),
'ycp': cols[6].text.strip().replace(",", ""),
'trade': cols[7].text.strip().replace(",", ""),
'value': cols[8].text.strip().replace(",", ""),
'volume': cols[9].text.strip().replace(",", "")
})
df = pd.DataFrame(quotes)
if symbol:
df = df.loc[df.symbol == symbol.upper()]
return df
else:
return df
return df
12 changes: 10 additions & 2 deletions bdshare/util/tickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
@group : bdshare.xyz
@contact: [email protected]
"""
import json

class Tickers(object):
def __init__(self):
pass
self.f = open('tickers.json')
self.data = json.load(self.f)

def close(self):
self.f.close()

def ticker_data(self, ticker=None):
pass
if ticker:
self.data['data']['companies' == ticker]
else:
self.data['data']['companies']

0 comments on commit a2b7102

Please sign in to comment.