Skip to content

Instantly share code, notes, and snippets.

@mdmitry1
Last active December 9, 2025 16:13
Show Gist options
  • Select an option

  • Save mdmitry1/eaec7845623bf35e8e178905786977d6 to your computer and use it in GitHub Desktop.

Select an option

Save mdmitry1/eaec7845623bf35e8e178905786977d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3.12
import json
import pandas as pd
# Read the JSON file
with open('funds.json', 'r', encoding='utf-8') as f:
data = json.load(f)
# Extract the result array
funds_list = data['funds']['result']
# Flatten the nested structure
flattened_data = []
for fund in funds_list:
row = {
'fundId': fund['fundId'],
'fundName': fund['fundName'],
'fundLongName': fund['fundLongName'],
'listingStatusId': fund['listingStatusId'],
'classificationMajor_code': fund['classificationMajor']['code'] if fund['classificationMajor'] else None,
'classificationMajor_value': fund['classificationMajor']['value'] if fund['classificationMajor'] else None,
'classificationMain_code': fund['classificationMain']['code'] if fund['classificationMain'] else None,
'classificationMain_value': fund['classificationMain']['value'] if fund['classificationMain'] else None,
'classificationSecondary_code': fund['classificationSecondary']['code'] if fund['classificationSecondary'] else None,
'classificationSecondary_value': fund['classificationSecondary']['value'] if fund['classificationSecondary'] else None,
'exposureProfile': fund['exposureProfile'],
'isin': fund['isin'],
'underlyingAsset1_code': fund['underlyingAsset'][0]['code'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset1_weight': fund['underlyingAsset'][0]['weight'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset1_value': fund['underlyingAsset'][0]['value'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset2_code': fund['underlyingAsset'][1]['code'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset2_weight': fund['underlyingAsset'][1]['weight'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset2_value': fund['underlyingAsset'][1]['value'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset3_code': fund['underlyingAsset'][2]['code'] if len(fund['underlyingAsset']) > 2 else None,
'underlyingAsset3_weight': fund['underlyingAsset'][2]['weight'] if len(fund['underlyingAsset']) > 2 else None,
'underlyingAsset3_value': fund['underlyingAsset'][2]['value'] if len(fund['underlyingAsset']) > 2 else None,
'fundType_code': fund['fundType'][0]['code'] if fund['fundType'] else None,
'fundType_value': fund['fundType'][0]['value'] if fund['fundType'] else None
}
flattened_data.append(row)
# Create DataFrame
df = pd.DataFrame(flattened_data)
# Display the DataFrame
#print(df)
#print(f"\nDataFrame shape: {df.shape}")
#print(f"\nColumn names:\n{df.columns.tolist()}")
# Find funds with 3 underlying assets
funds_with_3_assets = df[df['underlyingAsset3_code'].notna()]
print("Examples of funds with 3 or more underlying assets:")
print("="*60)
if not funds_with_3_assets.empty:
counter=0
for idx, row in funds_with_3_assets.iterrows():
print(f"{idx}: ", end='')
print(f"Fund ID: {row['fundId']}", end='')
print(f"; Fund Name: {row['fundName']}")
#print(f"Long Name: {row['fundLongName']}")
#print(f" Asset 1: {row['underlyingAsset1_value']} ({row['underlyingAsset1_weight']}%)")
#print(f" Asset 2: {row['underlyingAsset2_value']} ({row['underlyingAsset2_weight']}%)")
#print(f" Asset 3: {row['underlyingAsset3_value']} ({row['underlyingAsset3_weight']}%)")
counter += 1
if counter > 10:
break
else:
print("No funds with 3 underlying assets found.")
#!/usr/bin/python3.14
import json
import pandas as pd
# Read the JSON file
with open('funds.json', 'r', encoding='utf-8') as f:
data = json.load(f)
# Extract the result array
funds_list = data['funds']['result']
# Flatten the nested structure
flattened_data = []
for fund in funds_list:
row = {
'fundId': fund['fundId'],
'fundName': fund['fundName'],
'fundLongName': fund['fundLongName'],
'listingStatusId': fund['listingStatusId'],
'classificationMajor_code': fund['classificationMajor']['code'] if fund['classificationMajor'] else None,
'classificationMajor_value': fund['classificationMajor']['value'] if fund['classificationMajor'] else None,
'classificationMain_code': fund['classificationMain']['code'] if fund['classificationMain'] else None,
'classificationMain_value': fund['classificationMain']['value'] if fund['classificationMain'] else None,
'classificationSecondary_code': fund['classificationSecondary']['code'] if fund['classificationSecondary'] else None,
'classificationSecondary_value': fund['classificationSecondary']['value'] if fund['classificationSecondary'] else None,
'exposureProfile': fund['exposureProfile'],
'isin': fund['isin'],
'underlyingAsset1_code': fund['underlyingAsset'][0]['code'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset1_weight': fund['underlyingAsset'][0]['weight'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset1_value': fund['underlyingAsset'][0]['value'] if len(fund['underlyingAsset']) > 0 else None,
'underlyingAsset2_code': fund['underlyingAsset'][1]['code'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset2_weight': fund['underlyingAsset'][1]['weight'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset2_value': fund['underlyingAsset'][1]['value'] if len(fund['underlyingAsset']) > 1 else None,
'underlyingAsset3_code': fund['underlyingAsset'][2]['code'] if len(fund['underlyingAsset']) > 2 else None,
'underlyingAsset3_weight': fund['underlyingAsset'][2]['weight'] if len(fund['underlyingAsset']) > 2 else None,
'underlyingAsset3_value': fund['underlyingAsset'][2]['value'] if len(fund['underlyingAsset']) > 2 else None,
'fundType_code': fund['fundType'][0]['code'] if fund['fundType'] else None,
'fundType_value': fund['fundType'][0]['value'] if fund['fundType'] else None
}
flattened_data.append(row)
# Create DataFrame
df = pd.DataFrame(flattened_data)
# Display the DataFrame
#print(df)
#print(f"\nDataFrame shape: {df.shape}")
#print(f"\nColumn names:\n{df.columns.tolist()}")
# Find funds with 3 underlying assets
funds_with_3_assets = df[df['underlyingAsset3_code'].notna()]
print("Examples of funds with 3 or more underlying assets:")
print("="*60)
if not funds_with_3_assets.empty:
counter=0
for idx, row in funds_with_3_assets.iterrows():
print(f"{idx}: ", end='')
print(f"Fund ID: {row['fundId']}", end='')
print(f"; Fund Name: {row['fundName']}")
#print(f"Long Name: {row['fundLongName']}")
#print(f" Asset 1: {row['underlyingAsset1_value']} ({row['underlyingAsset1_weight']}%)")
#print(f" Asset 2: {row['underlyingAsset2_value']} ({row['underlyingAsset2_weight']}%)")
#print(f" Asset 3: {row['underlyingAsset3_value']} ({row['underlyingAsset3_weight']}%)")
counter += 1
if counter > 10:
break
else:
print("No funds with 3 underlying assets found.")
#!/usr/bin/tcsh -f
set script_path=`realpath $0 | xargs dirname`
set funds=funds.json
set fund_types=fund_types.json
set fund_currency_exposure=fund_currency_exposure.json
set fund_share_exposure=fund_share_exposure.json
set indices_basic=indices_basic.json
set indices_online=indices_online.json
set companies=companies.json
if($#argv > 0 ) then
if("-clean" == "$argv[1]") then
\rm -rf $funds $fund_types $fund_currency_exposure $fund_share_exposure \
$indices_basic $indices_online $companies >& /dev/null
exit(0)
endif
endif
$script_path/tasepy_demo.py --funds $funds \
--fund_types $fund_types \
--fund_currency_exposure $fund_currency_exposure \
--fund_share_exposure $fund_share_exposure \
--indices_basic $indices_basic \
--indices_online $indices_online \
--companies $companies
$script_path/funds_query_ex.py
echo "============================================================"
echo " מדדים עיקריים"
echo "============================================================"
$script_path/tasepy_main_indices.py
#!/usr/bin/tcsh -f
set script_path=`realpath $0 | xargs dirname`
set funds=funds.json
set fund_types=fund_types.json
set fund_currency_exposure=fund_currency_exposure.json
set fund_share_exposure=fund_share_exposure.json
set indices_basic=indices_basic.json
set indices_online=indices_online.json
set companies=companies.json
if($#argv > 0 ) then
if("-clean" == "$argv[1]") then
\rm -rf $funds $fund_types $fund_currency_exposure $fund_share_exposure \
$indices_basic $indices_online $companies >& /dev/null
exit(0)
endif
endif
$script_path/tasepy_demo_3.14.py --funds $funds \
--fund_types $fund_types \
--fund_currency_exposure $fund_currency_exposure \
--fund_share_exposure $fund_share_exposure \
--indices_basic $indices_basic \
--indices_online $indices_online \
--companies $companies
$script_path/funds_query_ex_3.14.py
echo "============================================================"
echo " מדדים עיקריים"
echo "============================================================"
$script_path/tasepy_main_indices_3.14.py
{ "0": "ת\"א-125",
"1": "ת\"א-35",
"2": "ת\"א בנקים-5"
}
#!/usr/bin/tcsh -f
"/bin/true" '''\'
exec /usr/bin/python3.14 $0 https://datawise.tase.co.il/v1
'''
'''
https://habr.com/ru/articles/962608
'''
import typer
import requests
import platform
from typing import List
from rich.console import Console
from rich.table import Table
from rich.progress import track
console = Console()
def is_running_in_wsl():
"""
Checks if the current Python environment is running within WSL.
"""
release_info = platform.release()
return "-Microsoft" in release_info or "microsoft-standard-WSL" in release_info
def get_status_emoji(status_code: int) -> str:
"""Возвращает эмодзи в зависимости от статус-кода."""
ok = ['✅','✅']
redirect = ['➡️','➡️']
client_error = ['❌','❌']
server_error = ['🔥','🔥']
unknown = ['❓','❓']
if 200 <= status_code < 300:
return ok[is_running_in_wsl()] + " OK"
elif 300 <= status_code < 400:
return redirect[is_running_in_wsl()] + " REDIRECT"
elif 400 <= status_code < 500:
return client_error[is_running_in_wsl()] + " CLIENT ERROR"
elif 500 <= status_code < 600:
return server_error[is_running_in_wsl()] + " SERVER ERROR"
return unknown[is_running_in_wsl()] + " UNKNOWN"
def main(urls: List[str] = typer.Argument(..., help="Список URL для проверки.")):
"""
Проверяет доступность сайтов и выводит результат в виде таблицы.
"""
table = Table(title="[bold]תוצאות בדיקת אתרי אינטרנט")
table.add_column(" סטטוס", justify="left", style="green")
table.add_column("קוד סטטוס", justify="center")
table.add_column("כתובת אתר", style="cyan", no_wrap=True)
for url in track(urls, description="[bold] בדיקת אתרים"):
try:
response = requests.get(url, timeout=5)
status_code = response.status_code
status_text = get_status_emoji(status_code)
# Раскрашиваем строку в зависимости от статуса
row_style = ""
if 300 <= status_code < 400:
row_style = "yellow"
elif status_code >= 400:
row_style = "red"
table.add_row(url, str(status_code), status_text, style=row_style)
except requests.exceptions.RequestException as e:
error_symbol=['💥','💥']
table.add_row(url, "N/A", f"{error_symbol[is_running_in_wsl()]} ERROR: {e.__class__.__name__}", style="bold red")
console.print(table)
if __name__ == "__main__":
typer.run(main)
#!/usr/bin/tcsh -f
"/bin/true" '''\'
setenv PYTHONPATH `realpath $0 | xargs dirname`/python_packages
if($#argv > 0 ) then
if("-clean" == "$argv[1]") then
\rm -rf $PYTHONPATH >& /dev/null
exit(0)
endif
endif
if(! -d $PYTHONPATH) then
/usr/bin/pip3.12 install tasepy --target $PYTHONPATH
endif
exec /usr/bin/python3.12 $0 $*
'''
from tasepy import quick_client
from dotenv import load_dotenv
from json import loads, dump
from os import getenv, remove
from os.path import realpath, dirname, basename, exists
from sys import argv
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from rich import print as rprint
from loguru import logger
usage = "\n " + basename(argv[0])
usage = usage + "\n [<-fd|--funds> <json>]"
usage = usage + "\n [<-tp|--fund_types> <json>]"
usage = usage + "\n [<-ce|--fund_currency_exposure> <json>]"
usage = usage + "\n [<-se|--fund_share_exposure> <json>]"
usage = usage + "\n [<-ib|--indices_basic> <json>]"
usage = usage + "\n [<-io|--indices_online> <json>]"
usage = usage + "\n [<-co|--compaines <json>]"
parser = ArgumentParser( prog=argv[0], usage=usage, description = "Tasepy CLI interface",
formatter_class=RawDescriptionHelpFormatter,
epilog=('This help message is printed, if no arguments are provided'))
if len(argv)==1:
parser.print_help()
exit(1)
parser.add_argument('--funds', '-fd', required=False)
parser.add_argument('--fund_types', '-tp', required=False)
parser.add_argument('--fund_currency_exposure', '-ce', required=False)
parser.add_argument('--fund_share_exposure', '-se', required=False)
parser.add_argument('--indices_basic', '-ib', required=False )
parser.add_argument('--indices_online', '-io', required=False )
parser.add_argument('--companies', '-co', required=False )
args=parser.parse_args()
env_file= dirname(realpath(argv[0])) + "/.env"
if exists(env_file):
load_dotenv(env_file)
tase_api_key = getenv("TASE_API_KEY")
if tase_api_key is None:
rprint("\n[red]ERROR: TASE_API_KEY is not set. Exiting ...[/red]\n")
exit(1)
print("TASE_API_KEY = " + "*" * len(tase_api_key))
client = quick_client()
if args.funds:
funds = client.funds.get_funds()
funds_json=loads(funds.model_dump_json())
with open(args.funds, "w") as f:
dump(funds_json, f, ensure_ascii=False, indent=4)
if args.fund_types:
fund_types = client.funds.get_types()
fund_types_json=loads(fund_types.model_dump_json())
with open(args.fund_types, "w") as f:
dump(fund_types_json, f, ensure_ascii=False, indent=4)
if args.fund_currency_exposure:
fund_currency_exposure = client.funds.get_currency_exposure_profiles()
fund_currency_exposure_json=loads(fund_currency_exposure.model_dump_json())
with open(args.fund_currency_exposure, "w") as f:
dump(fund_currency_exposure_json, f, ensure_ascii=False, indent=4)
if args.fund_share_exposure:
fund_share_exposure = client.funds.get_share_exposure_profiles()
fund_share_exposure_json=loads(fund_share_exposure.model_dump_json())
with open(args.fund_share_exposure, "w") as f:
dump(fund_share_exposure_json, f, ensure_ascii=False, indent=4)
if args.indices_basic:
indices=client.indices_basic.get_indices_list()
indices_json=loads(indices.model_dump_json())
with open(args.indices_basic,"w") as f:
dump(indices_json, f, ensure_ascii=False, indent=4)
if args.indices_online:
try:
indices_online=client.indices_online.get_last_rate()
indices_online_json=loads(indices_online.model_dump_json())
with open(args.indices_online,"w") as f:
dump(indices_online_json, f, ensure_ascii=False, indent=4)
except Exception as e:
logger.warning(f"Online indices are not available now. Please, try again later")
if args.companies:
companies=client.securities_basic.get_companies_list()
companies_json=loads(companies.model_dump_json())
with open(args.companies,"w") as f:
dump(companies_json, f, ensure_ascii=False, indent=4)
#!/usr/bin/python3.14
from tasepy import quick_client
from dotenv import load_dotenv
from json import loads, dump
from os import getenv, remove
from os.path import realpath, dirname, basename, exists
from sys import argv
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from rich import print as rprint
from loguru import logger
usage = "\n " + basename(argv[0])
usage = usage + "\n [<-fd|--funds> <json>]"
usage = usage + "\n [<-tp|--fund_types> <json>]"
usage = usage + "\n [<-ce|--fund_currency_exposure> <json>]"
usage = usage + "\n [<-se|--fund_share_exposure> <json>]"
usage = usage + "\n [<-ib|--indices_basic> <json>]"
usage = usage + "\n [<-io|--indices_online> <json>]"
usage = usage + "\n [<-co|--compaines <json>]"
parser = ArgumentParser( prog=argv[0], usage=usage, description = "Tasepy CLI interface",
formatter_class=RawDescriptionHelpFormatter,
epilog=('This help message is printed, if no arguments are provided'))
if len(argv)==1:
parser.print_help()
exit(1)
parser.add_argument('--funds', '-fd', required=False)
parser.add_argument('--fund_types', '-tp', required=False)
parser.add_argument('--fund_currency_exposure', '-ce', required=False)
parser.add_argument('--fund_share_exposure', '-se', required=False)
parser.add_argument('--indices_basic', '-ib', required=False )
parser.add_argument('--indices_online', '-io', required=False )
parser.add_argument('--companies', '-co', required=False )
args=parser.parse_args()
env_file= dirname(realpath(argv[0])) + "/.env"
if exists(env_file):
load_dotenv(env_file)
tase_api_key = getenv("TASE_API_KEY")
if tase_api_key is None:
rprint("\n[red]ERROR: TASE_API_KEY is not set. Exiting ...[/red]\n")
exit(1)
print("TASE_API_KEY = " + "*" * len(tase_api_key))
client = quick_client()
if args.funds:
funds = client.funds.get_funds()
funds_json=loads(funds.model_dump_json())
with open(args.funds, "w") as f:
dump(funds_json, f, ensure_ascii=False, indent=4)
if args.fund_types:
fund_types = client.funds.get_types()
fund_types_json=loads(fund_types.model_dump_json())
with open(args.fund_types, "w") as f:
dump(fund_types_json, f, ensure_ascii=False, indent=4)
if args.fund_currency_exposure:
fund_currency_exposure = client.funds.get_currency_exposure_profiles()
fund_currency_exposure_json=loads(fund_currency_exposure.model_dump_json())
with open(args.fund_currency_exposure, "w") as f:
dump(fund_currency_exposure_json, f, ensure_ascii=False, indent=4)
if args.fund_share_exposure:
fund_share_exposure = client.funds.get_share_exposure_profiles()
fund_share_exposure_json=loads(fund_share_exposure.model_dump_json())
with open(args.fund_share_exposure, "w") as f:
dump(fund_share_exposure_json, f, ensure_ascii=False, indent=4)
if args.indices_basic:
indices=client.indices_basic.get_indices_list()
indices_json=loads(indices.model_dump_json())
with open(args.indices_basic,"w") as f:
dump(indices_json, f, ensure_ascii=False, indent=4)
if args.indices_online:
try:
indices_online=client.indices_online.get_last_rate()
indices_online_json=loads(indices_online.model_dump_json())
with open(args.indices_online,"w") as f:
dump(indices_online_json, f, ensure_ascii=False, indent=4)
except Exception as e:
logger.warning(f"Online indices are not available now. Please, try again later")
if args.companies:
companies=client.securities_basic.get_companies_list()
companies_json=loads(companies.model_dump_json())
with open(args.companies,"w") as f:
dump(companies_json, f, ensure_ascii=False, indent=4)
#!/usr/bin/tcsh -f
"/bin/true" '''\'
setenv PYTHONPATH `realpath $0 | xargs dirname`/python_packages
if($#argv > 0 ) then
if("-clean" == "$argv[1]") then
\rm -rf $PYTHONPATH >& /dev/null
exit(0)
endif
endif
if(! -d $PYTHONPATH) then
/usr/bin/pip3.12 install tasepy --target $PYTHONPATH
endif
exec /usr/bin/python3.12 $0 $*
'''
"""
Get 3 main indeces of Tel Aviv stock exhange
"""
from tasepy import quick_client
from dotenv import load_dotenv
from os.path import realpath, dirname
from sys import argv
from json import loads, load
from typing import Tuple
from pydantic import RootModel
from rich import print as rprint
from loguru import logger
class DataTuple(RootModel[Tuple[float, float, str]]):
"""
A Pydantic model for a tuple containing two floats.
The root value is accessed via the `root` attribute.
"""
pass
def get_index_last_rate(index_id: int) -> DataTuple:
last_rate=loads(client.indices_online.get_last_rate(index_id).model_dump_json())
raw_data = (last_rate["getIndexTradingDataIntraDay"]["lastIndexRate"], last_rate["getIndexTradingDataIntraDay"]["change"], last_rate["getIndexTradingDataIntraDay"]["lastSaleTime"])
return DataTuple.model_validate(raw_data)
env_file= dirname(realpath(argv[0])) + "/.env"
load_dotenv(env_file)
client = quick_client()
indices=client.indices_basic.get_indices_list()
indices_json=loads(indices.model_dump_json())
# Main indices
with open(dirname(realpath(argv[0])) + "/selected_indices.json") as input_json:
selected_indices = load(input_json)
# Build reverse mapping for O(1) lookup
name_to_key = {name: int(key) for key, name in selected_indices.items()}
# Initialize with None for clearer error handling
selected_id = [None, None, None]
# Build index table and find selected ids
index_table=dict()
for idx in indices_json["indicesList"]["result"]:
index_name = idx["indexName"]
# Fill index_table and assign selected ids
if index_name in name_to_key:
index_id = idx["indexId"]
index_table[index_id] = index_name
selected_id[name_to_key[index_name]] = index_id
rprint(f"[bold]{'שם'} {'אחרון'} {'שינוי'} {'זמן המכירה האחרונה'}")
for idx in (selected_id):
if idx:
try:
last_rate, change, last_trade = get_index_last_rate(idx).root
change_string = f"{change:.2f} " if change >=0 else f"{-change:.2f}-"
change_pretty = "[green]" + change_string + "[/green]" if change >= 0 else "[red]" + change_string + "[/red]"
rprint(f" {index_table[idx]} {last_rate:.2f} {change_pretty} [magenta]{last_trade}[/magenta]")
except Exception as e:
logger.error(f"Online indices are not available now. Please, try again later")
exit(1)
#!/usr/bin/python3.14
"""
Get 3 main indeces of Tel Aviv stock exhange
"""
from tasepy import quick_client
from dotenv import load_dotenv
from os.path import realpath, dirname
from sys import argv
from json import loads, load
from typing import Tuple
from pydantic import RootModel
from rich import print as rprint
from loguru import logger
class DataTuple(RootModel[Tuple[float, float, str]]):
"""
A Pydantic model for a tuple containing two floats.
The root value is accessed via the `root` attribute.
"""
pass
def get_index_last_rate(index_id: int) -> DataTuple:
last_rate=loads(client.indices_online.get_last_rate(index_id).model_dump_json())
raw_data = (last_rate["getIndexTradingDataIntraDay"]["lastIndexRate"], last_rate["getIndexTradingDataIntraDay"]["change"], last_rate["getIndexTradingDataIntraDay"]["lastSaleTime"])
return DataTuple.model_validate(raw_data)
env_file= dirname(realpath(argv[0])) + "/.env"
load_dotenv(env_file)
client = quick_client()
indices=client.indices_basic.get_indices_list()
indices_json=loads(indices.model_dump_json())
# Main indices
with open(dirname(realpath(argv[0])) + "/selected_indices.json") as input_json:
selected_indices = load(input_json)
# Build reverse mapping for O(1) lookup
name_to_key = {name: int(key) for key, name in selected_indices.items()}
# Initialize with None for clearer error handling
selected_id = [None, None, None]
# Build index table and find selected ids
index_table=dict()
for idx in indices_json["indicesList"]["result"]:
index_name = idx["indexName"]
# Fill index_table and assign selected ids
if index_name in name_to_key:
index_id = idx["indexId"]
index_table[index_id] = index_name
selected_id[name_to_key[index_name]] = index_id
rprint(f"[bold]{'שם'} {'אחרון'} {'שינוי'} {'זמן המכירה האחרונה'}")
for idx in (selected_id):
if idx:
try:
last_rate, change, last_trade = get_index_last_rate(idx).root
change_string = f"{change:.2f} " if change >=0 else f"{-change:.2f}-"
change_pretty = "[green]" + change_string + "[/green]" if change >= 0 else "[red]" + change_string + "[/red]"
rprint(f" {index_table[idx]} {last_rate:.2f} {change_pretty} [magenta]{last_trade}[/magenta]")
except Exception as e:
logger.error(f"Online indices are not available now. Please, try again later")
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment