forked from WLM1ke/apimoex
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_сcurrencies.py
More file actions
33 lines (28 loc) · 851 Bytes
/
get_сcurrencies.py
File metadata and controls
33 lines (28 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import moex
import pandas as pd
# get names
with requests.Session() as session:
data = moex.requests.get_board_securities(
session=session,
engine="currency",
market="selt",
board="CETS",
columns=("SECID", "SHORTNAME", "NAME", "LATNAME", "CURRENCYID"),
)
df = pd.DataFrame(data)
# get history
with requests.Session() as session:
data = moex.requests.get_board_history(
session=session,
security="GLDRUB_TOM",
engine="currency",
market="selt",
board="CETS",
start="2024-01-01",
end="2024-02-01"
# columns=("SECID", "LATNAME", "CURRENCYID", "FREQUENCY", "TYPE", "TYPENAME", "IS_TRADED", "CONSTITUENTS"),
)
df1 = pd.DataFrame(data)
print(df[df["SECID"].str.contains("pltrub_tom", case=False)])
print(df1)