Esempio n. 1
0
def test_from_dict():
    swap = IRSwap('Receive', '3m', 'USD', fixedRate=0, notionalAmount=1)
    properties = swap.as_dict()
    new_swap = Instrument.from_dict(properties)
    assert swap == new_swap

    # setting a datetime.date should work in a dictionary
    swap = IRSwap('Receive',
                  dt.date(2030, 4, 11),
                  'USD',
                  fixedRate='atm+5',
                  notionalAmount=1)
    properties = swap.as_dict()
    new_swap = Instrument.from_dict(properties)
    assert swap == new_swap
Esempio n. 2
0
from gs_quant.common import PayReceive, Currency  # import constants
from gs_quant.instrument import IRSwap  # import instruments
from gs_quant.session import Environment, GsSession  # import sessions

client_id = None  # Supply your application id
client_secret = None  # Supply your client secret
scopes = ('run_analytics', )
GsSession.use(Environment.PROD, client_id, client_secret, scopes)

my_swap = IRSwap(PayReceive.Pay, '5y', Currency.USD)  # 5y USD payer
print(my_swap.as_dict())  # print my_swap properties
def test_from_dict():
    swap = IRSwap('Receive', '3m', 'USD', fixedRate=0, notionalAmount=1)
    properties = swap.as_dict()
    new_swap = Instrument.from_dict(properties)
    assert swap == new_swap