Guest User

Untitled

a guest
May 8th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.03 KB | None | 0 0
  1. Ticker_base_asset_d=['MX']
  2. Month_OPT_d = ['A', 'B', 'C']
  3. Strikes_d = [[5000,160000,370000],[50,1700,3700],[2500,27500,230000]]
  4.  
  5. Ticker_d=[]
  6. for i in range(len(Ticker_base_asset_d)):
  7.     Month_d=[]
  8.     for j in range(len(Month_OPT_d)):
  9.         data_d=[]
  10.         for h in range(Strikes_d[i][1], Strikes_d[i][2]+1, Strikes_d[i][0]):
  11.             url=f'https://iss.moex.com/iss/engines/futures/markets/options/\
  12. securities/{Ticker_base_asset_d[i]}{h}B{Month_OPT_d[j]}9/candles.csv?from=\
  13. 2019-01-01&till=2020-01-01&interval=24&iss.meta=on'
  14.             data_sheet=[]
  15.             try:
  16.                 data_sheet = pd.read_csv(url,sep=";",skiprows=3)
  17.             except Exception:
  18.                 pass
  19.             data_d.append(data_sheet)
  20.         Month_d.append(data_d)
  21.     Ticker_d.append(Month_d)
  22.  
  23.  
  24. Вывод
  25. [[[],
  26.   [],
  27.   [],
  28.   [],
  29.   [],
  30.   [],
  31.   [],
  32.   [],
  33.   [],
  34.   [],
  35.   [],
  36.   [],
  37.   [],
  38.   [],
  39.   [],
  40.   [],
  41.   [],
  42.   Empty DataFrame
  43.   Columns: [1000, 1775, 1775.1, 1000.1, 0, 90, 2019-01-17 00:00:00, 2019-01-17 23:59:59]
  44.   Index: [],
  45.   [],
  46.   [],
  47.   [],
  48.   [],
  49.   [],
  50.   [],
  51.   [],
  52.   [],
  53.   [],
  54.   [],
  55.   [],
  56.   [],
  57.   [],
  58.   [],
  59.   [],
  60.   [],
  61.   [],
  62.   [],
  63.   [],
  64.   [],
  65.   [],
  66.   [],
  67.   [],
  68.   [],
  69.   []],
  70.  [[],
  71.   [],
  72.   [],
  73.   [],
  74.   [],
  75.   [],
  76.   [],
  77.   [],
  78.   [],
  79.   [],
  80.   [],
  81.   [],
  82.   [],
  83.   [],
  84.   [],
  85.   [],
  86.   [],
  87.   [],
  88.   [],
  89.   [],
  90.   [],
  91.   [],
  92.   [],
  93.   [],
  94.   [],
  95.   [],
  96.   [],
  97.   [],
  98.   [],
  99.   [],
  100.   [],
  101.   [],
  102.   [],
  103.   [],
  104.   [],
  105.   [],
  106.   [],
  107.   [],
  108.   [],
  109.   [],
  110.   [],
  111.   [],
  112.   []],
  113.  [[],
  114.   [],
  115.   [],
  116.   [],
  117.   [],
  118.   [],
  119.   [],
  120.   [],
  121.   [],
  122.   [],
  123.   [],
  124.   [],
  125.   [],
  126.   [],
  127.   [],
  128.   [],
  129.   [],
  130.   [],
  131.   [],
  132.   Empty DataFrame
  133.   Columns: [325, 325.1, 325.2, 325.3, 0, 1, 2019-03-18 00:00:00, 2019-03-18 23:59:59]
  134.   Index: [],
  135.   Empty DataFrame
  136.   Columns: [325, 325.1, 325.2, 325.3, 0, 1, 2019-03-12 00:00:00, 2019-03-12 23:59:59]
  137.   Index: [],
  138.   [],
  139.   [],
  140.   [],
  141.   [],
  142.   [],
  143.   [],
  144.   [],
  145.   [],
  146.   [],
  147.   [],
  148.   [],
  149.   [],
  150.   [],
  151.   [],
  152.   [],
  153.   [],
  154.   [],
  155.   [],
  156.   [],
  157.   [],
  158.   [],
  159.   []]]
Add Comment
Please, Sign In to add comment