I have this algo that computes the top 5 gainers and losers by percentage over the course of a given day.
The final output is coming through from
top_gainers = todays_gain_since_yesterday_close.nlargest(5)
top_losers = todays_gain_since_yesterday_close.nsmallest(5)
log.info('top gainers \n{} top losers \n{}'.format(top_gainers, top_losers))
and the output looks like
2020-05-19 08:40 handle_data:75 INFO top gainers
Equity(25972 [DVAX]) 37.796087
Equity(2385 [DY]) 20.426344
Equity(11120 [EXP]) 8.914729
Equity(50735 [AYX]) 7.648747
Equity(45113 [DOC]) 7.509271
dtype: float64 top losers
Equity(52864 [GOSS]) -14.993351
Equity(46206 [CPG]) -14.803625
Equity(52119 [TCDA]) -9.505703
Equity(53083 [TPTX]) -8.554688
Equity(50807 [CVNA]) -7.919286
I know the output is a series, and the series consists of the equity and the calculated percentage. What I would like to know is how to attach volume to the output of these logs? Is there a pandas method to do this?
I want it to look like this, where the third item is the current volume of the respective equity
2020-05-19 08:40 handle_data:75 INFO top gainers
Equity(25972 [DVAX]) 37.796087 3000000
Equity(2385 [DY]) 20.426344 373467
Equity(11120 [EXP]) 8.914729 457345257
Equity(50735 [AYX]) 7.648747 3457345645
Equity(45113 [DOC]) 7.509271 5626232
dtype: float64 top losers
Equity(52864 [GOSS]) -14.993351 3456345
Equity(46206 [CPG]) -14.803625 534563456
Equity(52119 [TCDA]) -9.505703 4563456345
Equity(53083 [TPTX]) -8.554688 456345634
Equity(50807 [CVNA]) -7.919286 576744357
Anyone have any suggestions?