Package: whale-alert
WhaleAlert - Cryptocurrecy Whale Alert API LoggerA python API and script for requesting, parsing and storing the latest cryptocurrency data availalbe using theWhale Alert Free API. Data entries are stored in a SQLite3 database, with CLI features for querying data and logger status.Using the APITo use any feature of this API, an account and free API key needs to be obtained fromWhale Alert>>>importtime>>>frompprintimportpprint# For formatted dictionary printing>>>fromwhalealert.whalealertimportWhaleAlert>>>whale=WhaleAlert()# Specify a single transaction from the last 10 minutes>>>start_time=int(time.time()-600)>>>api_key='your-key-to-stonks'>>>transaction_count_limit=1>>>success,transactions,status=whale.get_transactions(start_time,api_key=api_key,limit=transaction_count_limit)>>>successtrue>>>pprint(transactions)[{'amount':1000000,'amount_usd':997749.6,'blockchain':'ethereum','from':{'address':'46705dfff24256421a05d056c29e81bdc09723b8','owner':'huobi','owner_type':'exchange'},'hash':'d1e52138ecf959e580fc3167b10977dfe3114f883136bebd3317f5b5c35762b4','id':'710406265','symbol':'USDT','timestamp':1591028741,'to':{'address':'c1b5915fd74cce2a4a9b889b0bc1efcac6af45af','owner':'','owner_type':'unknown'},'transaction_count':1,'transaction_type':'transfer'}]>>>pprint(status){'error_code':200,'error_message':'','timestamp':'2020-06-01T19:35:19.051584','transaction_count':1}Using the Data Logging FunctionThe module automatically installs a python scriptwhaleAlertLoggerand adds it to your python binary directory.The python script automatically polls the Whale Alert API for new transactions and saves them in an SQLite3 database.# Install the module and scriptpipinstallwhaleAlert# Initialise the required configuration, supplying your API key.whaleAlertLogger-a'your-api-key'-g# Start the logger.whaleAlertLogger&# Query the latest whale tranactionswhaleAlertLogger-q06/01/202020:01:25697730.00USDT(698,289.70USD)transferredfromunknowntounknown.06/01/202020:02:591000000.00USDT(996,660.90USD)transferredfromunknowntohuobi.# Query the latest 3 transactions, from the ethereum blockchain, with the tag USDT.whaleAlertLogger-q-bethereum-tUSDT06/01/202019:56:511000000.00USDT(997,847.70USD)transferredfromunknowntounknown.06/01/202020:01:25697730.00USDT(698,289.70USD)transferredfromunknowntounknown.06/01/202020:02:591000000.00USDT(996,660.90USD)transferredfromunknowntohuobi.# Get the  status of the logger.whaleAlertLogger-s
Lastsuccessfulcall0minutesago,health100.0%# Kill any running logger instancewhaleAlertLogger-k# Convert the SQLite3 database to an Excel filewhaleAlertLogger-xStored Database and ConfigurationWhen the logger is initialised, it creates a directory structure inside$XDG_CONFIG_HOME. This could be~/.local/share/whaleAlertLoggeror~/.config/whaleAlertLogger, useecho $XDG_CONFIG_HOMEto find the location on your system.The directory structure is as follows:whaleAlertLogger
├──config.ini
└──data├──whaleAlert.db├──log└──status.iniconfig.iniContains configuration parameters used. Change any of these settings and restart the logger to apply them. Values shown are the default.[API]api_private_key=your-private-key-hererequest_interval_seconds=30minimum_transaction_value 500000historical_limit 3599whaleAlert.dbA SQLite3 database containing all data retreived by the logger. The database contains a separate table, named after each unique blockchain.SQLitebrower, is a good tool for browsing databases, or usewhaleAlertLogger -xto convert the database to an Excel file for viewing.status.iniContains information on the status of the logger.[Last Successful Call]timestamp=2020-06-01T20:21:37.859798transaction_count=1[Last Failed Call]timestamp=2020-06-01T13:46:27.936514error_code=5error_message=Internal error: Error parsing JSON object from received response.[Current Session]successful_calls=5441failed_calls=10success_rate=99.82health=100.0[All Time]successful_calls=38651failed_calls=364success_rate=99.07logRuntime logs stored by the Python logging module.