diff options
| author | Anton Bobov <anton@bobov.name> | 2022-01-30 21:03:14 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2022-01-30 21:03:14 +0500 |
| commit | b25a5b794be7093dbcd556fcab2ebc50bb33e8b2 (patch) | |
| tree | 282659aa4c647c87e004273efd4d02599afbcec2 /ledger-price-db-update.py | |
| parent | c83690911af9326784d81e49e2b55de9688c1e9b (diff) | |
Updates.
Diffstat (limited to 'ledger-price-db-update.py')
| -rwxr-xr-x | ledger-price-db-update.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ledger-price-db-update.py b/ledger-price-db-update.py index eed54bc..0f517ff 100755 --- a/ledger-price-db-update.py +++ b/ledger-price-db-update.py @@ -73,7 +73,9 @@ def stocks(): params = {"assetclass": "stocks"} url = r'https://api.nasdaq.com/api/quote/%s/info' % (symbol) data = get_json(url, params=params) - price = float(data['data']['keyStats']['PreviousClose']['value'][1:]) + lastPriceString = data['data']['primaryData']['lastSalePrice'] + lastPrice = ''.join([c for c in lastPriceString if c.isdigit() or c == '.']) + price = float(lastPrice) print_price(symbol, price, '$') @@ -115,7 +117,7 @@ def bonds(): url = r'https://iss.moex.com/iss/engines/stock/markets/bonds/boards/TQOB/securities/%s.jsonp?from=%s' % ( symbol, date_str) else: - url = r'https://iss.moex.com/iss/engines/stock/markets/bonds/boards/EQOB/securities/%s.jsonp?from=%s' % ( + url = r'https://iss.moex.com/iss/engines/stock/markets/bonds/boards/TQCB/securities/%s.jsonp?from=%s' % ( symbol, date_str) data = get_json(url)['securities'] price = get_moex_value(data, 'PREVPRICE') |
