@@ -40,14 +40,17 @@ def mostactive():
40
40
output = str (day_active .at [0 , 'Symbol' ]) + ': ' + str (round (si .get_live_price (day_active .at [0 , 'Symbol' ]), roundNumber ))
41
41
return output
42
42
43
- def customticker (ticker ):
43
+ def customticker (tickers ):
44
44
"""Returns: stock price and ticker of a stock with format 'TICKER': 'PRICE'.
45
45
Parameter: the ticker to get a stock price on and to display.
46
- Precondition: ticker is a string."""
46
+ Precondition: ticker is a string[] ."""
47
47
48
- tickerPrice = si .get_live_price (ticker )
49
- output = ticker + ': ' + str (round (tickerPrice , roundNumber ))
50
- return output
48
+ output = []
49
+ for ticker in tickers :
50
+ tickerPrice = si .get_live_price (ticker )
51
+ output .append (ticker + ': ' + str (round (tickerPrice , roundNumber )))
52
+
53
+ return ' ' .join (output )
51
54
52
55
def topcrypto ():
53
56
"""Returns: cryptocurrency with the highest price in a given day and its name
@@ -67,7 +70,7 @@ def addArguments():
67
70
parser .add_argument ('--biggestgainer' , help = 'Prints the stock with the biggest gain in a given day.' , action = 'store_true' )
68
71
parser .add_argument ('--mostactive' , help = 'Prints the most active stock in a given day.' , action = 'store_true' )
69
72
parser .add_argument ('--topcrypto' , help = 'Prints the top cryptocurrency by market cap in a given day.' , action = 'store_true' )
70
- parser .add_argument ('--customticker' , help = 'Display the price of a custom ticker.' , type = str )
73
+ parser .add_argument ('--customticker' , action = 'append' , help = 'Display the price of a custom ticker.' , type = str )
71
74
72
75
args = parser .parse_args ()
73
76
0 commit comments