Ejemplo n.º 1
0
 def get_fx_spot_series(self) -> pd.Series:
     ds = Dataset('WMFXSPOT')
     coverage = ds.get_coverage()
     cross = self.currency + '/' + self.source_asset.currency
     asset_id = coverage[coverage['name'] == cross]['assetId'].values[0]
     time_series = ds.get_data(assetId=asset_id,
                               start=dt.date(1970, 1, 1))['midPrice']
     time_series = time_series[~time_series.index.duplicated(keep='last')]
     time_series.name = cross
     return time_series
Ejemplo n.º 2
0
# test API connectivity
request_url = 'https://api.marquee.gs.com/v1/users/self'
request = session.get(url=request_url)
print(request.text)
'''
from datetime import date
from gs_quant.data import Dataset
from gs_quant.markets.securities import SecurityMaster, AssetIdentifier 
from gs_quant.session import GsSession

client_id = ''
client_secret = ''

scopes = GsSession.Scopes.get_default()
GsSession.use(client_id=client_id, client_secret=client_secret, scopes=scopes)

ds = Dataset('USCANFPP_MINI')
print (ds)

gsids = ds.get_coverage()['gsid'].values.tolist()
df = ds.get_data(date(2012, 7, 2), date(2017, 6, 30), gsid=gsids[0:5])

print (df)

for idx, row in df.iterrows():
    marqueeAssetId = row['assetId']
    asset = SecurityMaster.get_asset(marqueeAssetId, AssetIdentifier.MARQUEE_ID)
    df.loc[df['assetId'] == marqueeAssetId, 'assetName'] = asset.name

print (df)
from datetime import date
from gs_quant.data import Dataset
from gs_quant.markets.securities import SecurityMaster, AssetIdentifier
from gs_quant.session import GsSession
import pandas as pd

itdoesntmatterjustdowhatever = open("data_raw.txt", 'w')
#sys.stdout = itdoesntmatterjustdowhatever

client_id = "b2a0a48a91854045b5c7eb12c8973901"
client_secret = "2cb4ec68204ddee53a1a892ea70ee110bc5db9c30aa04024336d69ea9e4fafc6"

scopes = GsSession.Scopes.get_default()
GsSession.use(client_id=client_id, client_secret=client_secret, scopes=scopes)

ds = Dataset("USCANFPP_MINI")

gsids = ds.get_coverage()["gsid"].values.tolist()
data = ds.get_data(date(2017, 1, 15), date(2018, 1, 15), gsid=gsids[0:5])

print(data.head())

for idx, row in data.iterrows():
    marqueeAssetId = row["assetId"]
    asset = SecurityMaster.get_asset(marqueeAssetId,
                                     AssetIdentifier.MARQUEE_ID)
    data.loc[data["assetId"] == marqueeAssetId, "assetName"] = asset.name

print(data.head())
itdoesntmatterjustdowhatever.write(data.to_string())