Back to Community
Extracting symbols from Series

Hi,

Newbie question. I've been googling this one for a while now.
I'm trying to put on a list, the symbols of equities from Series.

My Series:

Equity(13984 [TGTX]) 0.089146
Equity(13867 [IMH]) 0.091517
Equity(24094 [MGPI]) 0.093951
Equity(44955 [PTCT]) 0.094191

Desired output:

['TGTX,'IMH', 'MGPI', 'PTCT']

I really appreciate any help you can provide.
Cordially,

Victor

4 responses

Try this:
stock_list = ... whatever you are using to generate a list of stocks

symbol_list = stock_list.index

Thank you Peter.

I'm well aware of the stock_list.index command.
The output would look something like this:

Index([Equity(13984 [TGTX]), Equity(13867 [IMH]), Equity(24094 [MGPI]),
dtype='object')

However, if I'm going to use this to define my universe of stocks (e.g. universe=symbols('AAPL',etc.), shouldn't the output, be of this type?
['TGTX,'IMH', 'MGPI', 'PTCT']

OK.
Maybe this will be more useful.

Clone Algorithm
2
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57d71c42e4346210242ec69d
There was a runtime error.

Try this

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57d764b4abfa6d102ade000e
There was a runtime error.