nqs_sdk.nqs_sdk module

This module is the python Binding API. It’s expose every public item available for python.

class nqs_sdk.nqs_sdk.ProtocolFactoryAdapter(py_object)

Bases: object

class nqs_sdk.nqs_sdk.MetricName(parameters, name)

Bases: object

static deserialize(data)
class nqs_sdk.nqs_sdk.ObservableDescription(protocol_ids, aggregation_targets, aggregation_outputs)

Bases: object

aggregation_outputs

all the different metrics that will be output into aggregations

aggregation_targets

all the different exclusively owned fields that are legal to aggregate into, and which algo they should use

protocol_ids

all the different protocol ids for metrics, should generally be the protocol id

class nqs_sdk.nqs_sdk.Metrics

Bases: object

mirror of [simulator::ObserverOutputs]

get(name)
class nqs_sdk.nqs_sdk.Parameters

Bases: object

mirror of [simulator::Parameters]

add_common(tokens)
add_compound_v2_protocol(tokens)
add_json_protocol(config, name, params)
add_uniswap_v3_protocol(name, token0, token1)
add_yaml_protocol(config, name, params)
class nqs_sdk.nqs_sdk.SealedParameters

Bases: object

mirror of [simulator::SealedParameters]

all_agents()
metric_to_str(metric)
str_to_metric(str)
class nqs_sdk.nqs_sdk.MutBuilderSharedState

Bases: object

mirror of [simulator::SharedState]

builder_spot_oracle()
class nqs_sdk.nqs_sdk.MutSharedState

Bases: object

agent_name_to_addr(agent_name)
ensure_loaded_for_block(py_clock)
get_parameters()
get_wallet(addr)
insert_wallet(addr, py_wallet)
list_wallets()
py_wrapper_spot_oracle(py_clock)
class nqs_sdk.nqs_sdk.RefSharedState

Bases: object

agent_name_to_addr(agent_name)
get_parameters()
get_wallet(addr)
list_wallets()
py_wrapper_spot_oracle(py_clock)
class nqs_sdk.nqs_sdk.RevertibleSharedState

Bases: object

agent_name_to_addr(agent_name)
get_parameters()
get_wallet(addr)
insert_wallet(addr, py_wallet)
list_wallets()
py_wrapper_spot_oracle(py_clock)
class nqs_sdk.nqs_sdk.SimulationClock

Bases: object

mirror of [simulator::SimulationClock]

current_block()
current_time()
elapsed_time()
previous_observable_block()
simulation_time()
class nqs_sdk.nqs_sdk.SimulationTime

Bases: object

mirror of [simulator::SimulationClock]

block_at(time)
block_at_timestamp(timestamp)
clock_at(block)
first_block()
first_time()
start_block()
start_time()
stop_block()
time_at(block)
timestamp_at(block)
class nqs_sdk.nqs_sdk.Simulator

Bases: object

collect_observables(_metrics, _block)
static from_json(json)
get_py_protocol(id)
list_protocols()
run()

Will run all events of the simulation

run_to_dict()
run_with_gil()

Will run all events of the simulation

to_json()
class nqs_sdk.nqs_sdk.SimulatorBuilder

Bases: object

add_factory(factory)

Add a new factory to the list of factories

build()

Build the simulator

static from_json(config)

Create a new instance of the simulator builder from a json config file

static from_yaml(config)

Create a new instance of the simulator builder from a json config file

static new()

Create a new empty instance of the simulator builder

class nqs_sdk.nqs_sdk.TxRequest(protocol, source, sender, payload)

Bases: object

mirror of [simulator::TxRequest]

static new_random(protocol, source, payload)
static new_with_order(protocol, source, sender, order, payload)
order
payload
protocol
sender
source
class nqs_sdk.nqs_sdk.LPTokenUniv3(*args, **kwargs)

Bases: object

fee_growth_inside_0_last_x128
fee_growth_inside_1_last_x128
liquidity
pool_name
tick_lower
tick_upper
token_id
tokens_owed_0
tokens_owed_1
class nqs_sdk.nqs_sdk.StateERC721(*args, **kwargs)

Bases: object

pool_name
token_id
class nqs_sdk.nqs_sdk.TokenMetadata(*args, **kwargs)

Bases: object

decimals
name
symbol
class nqs_sdk.nqs_sdk.WalletState

Bases: object

class nqs_sdk.nqs_sdk.Wallet(*args, **kwargs)

Bases: object

agent_name
drop_token(token)
get_balance_of(token)
get_balance_of_float(token)
get_cerc20_tokens()
get_erc721_token(token_id, action_name=None)
get_erc721_tokens()
get_erc721_tokens_for_pool_name(pool_name)
get_float_representation(amount, identifier)
get_list_tokens()
get_next_token_id(token_id, pool_name)
get_py_metadata(symbol)
get_scaled_tokens()
get_state()
get_token_id_tick_range(token_id, action_name=None)
has_enough_balance(amount, identifier, action_name=None)
has_enough_liquidity(token, amount, action_name=None)
holdings
is_empty()

Check if the holdings is empty this method could be counterintuitive we add it for backward compatibility with python

mint_erc721(token)
replace_erc721_token(erc721_token)
restore_from_state(state)
tokens_metadata
transfer_from(token, amount, action_name=None)
transfer_to(token, amount, action_name=None)
nqs_sdk.nqs_sdk.version()

Return the version of the library

nqs_sdk.nqs_sdk.full_version()

Full version and build info

Return all build details about the library.

nqs_sdk.nqs_sdk.activate_log()