This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for doc in FW_STORE.query({ | |
"spec._tasks.0.job.function_args.0.charge": {"$exists": 1}, | |
"spec._tasks.0.job.function.@bound.write_additional_data.info:json": {"$exists": 1}, | |
# "fw_id" : {"$gt" : 1000} | |
} | |
): | |
chg_structure = doc["spec"]["_tasks"][0]["job"]["function_args"][0]["charge"] | |
chg_defect = doc["spec"]["_tasks"][0]["job"]["function"]["@bound"]["write_additional_data"]["info:json"]["charge_state"] | |
if chg_structure != chg_defect: | |
print('messed', doc["fw_id"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from monty.json import MontyDecoder | |
def mdecode(d): | |
return MontyDecoder().process_decoded(d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model, bought, sold, price = construct_model(total_trade_volume, orderbook) | |
@constraint(model, price[1] == 1) | |
@constraint(model, price[2] <= 1330.0) | |
@constraint(model, price[2] >= 1390.0) | |
@constraint(model, price[3] <= 19420.0) | |
@constraint(model, price[3] >= 19380.0) | |
optimize!(model) | |
summarize(orderbook, bought, sold, price) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o1 = LimitBuyOrder(1, 2, 1000, 1/1328) | |
o2 = LimitBuyOrder(3, 1, 0.1, 19400) | |
o3 = LimitBuyOrder(2, 3, 2, 1328/19400) | |
orderbook = OrderBook([o1, o2, o3], ["DAI", "ETH", "BTC"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model, bought, sold, price = construct_model(total_trade_volume, orderbook) | |
@constraint(model, price[1] == 1) | |
optimize!(model) | |
summarize(orderbook, bought, sold, price) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model, bought, sold, price = construct_model(total_trade_volume, orderbook) | |
@constraint(model, price[1] == 1) | |
optimize!(model) | |
summarize(orderbook, bought, sold, price) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model, bought, sold, price = construct_model(total_trade_volume, orderbook) | |
optimize!(model) | |
summarize(orderbook, bought, sold, price) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order1 = LimitBuyOrder(2, 1, 1, 1328.0) | |
order2 = LimitSellOrder(1, 2, 0.5, 0.00075) | |
orderbook = OrderBook([order1, order2], ["DAI", "ETH"]) | |
approx_prices = [1.0, 1328.0] | |
get_graph( | |
orderbook, | |
approx_prices; | |
min_val=1000, | |
max_val=2000, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LimitBuyOrder(2, 1, 6, 7.5E-4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the package | |
using DEXTra | |
@doc LimitBuyOrder |
NewerOlder