我想知道如何运行下面的脚本。
#------------Necessary Variables--------------#
import datetime as dt
symbols = ['INTC','VZ','AAPL', 'AMZN', 'MSFT', 'CAT', 'AXP', 'BA', 'GE', 'CVX', 'HD', 'NKE', 'PFE', 'MMM', 'TRV', 'UTX', 'MRK', 'DIS', 'DWDP', 'JNJ']
allocations = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]
start_date = dt.date(2017, 1, 3)
#Benchmark Index
bench_symbol = "SPY"
#RF Syntax: 6 MO, 2 YR etc.
rate = '1 YR'
rf_start_date = dt.date(2017, 1, 3)
#For Quandl
api_key = "key_here"
#Dirctory Input For Data and Reports
root_path = "C:\\Users\\Excel\\Documents\\Python Scripts"
end_date = dt.date.today()
#------------Run Program----------------------#
if __name__ == '__main__':
#1.) Import the module
import data
#Select Functions
data.portfolio()
data.benchmark()
它似乎从某种控制台窗口运行。我以前从未运行任何Python代码,这对我来说似乎不对。
代码来自以下链接。
http://programmingforfinance.com/2018/02/tracking-a-portfolio-with-python/