|
45 | 45 | Worker_initializer,
|
46 | 46 | isArgsThisClass,
|
47 | 47 | AssertPredicate,
|
| 48 | + LimitOrderAutoAction, |
| 49 | + LimitOrderCreateExtensions, |
48 | 50 | )
|
49 | 51 | from .operationids import operations
|
50 | 52 |
|
@@ -386,7 +388,10 @@ def __init__(self, *args, **kwargs):
|
386 | 388 | ("min_to_receive", Asset(kwargs["min_to_receive"])),
|
387 | 389 | ("expiration", PointInTime(kwargs["expiration"])),
|
388 | 390 | ("fill_or_kill", Bool(kwargs["fill_or_kill"])),
|
389 |
| - ("extensions", Set([])), |
| 391 | + ( |
| 392 | + "extensions", |
| 393 | + LimitOrderCreateExtensions(kwargs["extensions"]), |
| 394 | + ), |
390 | 395 | ]
|
391 | 396 | )
|
392 | 397 | )
|
@@ -1226,4 +1231,104 @@ def __init__(self, *args, **kwargs):
|
1226 | 1231 | )
|
1227 | 1232 |
|
1228 | 1233 |
|
| 1234 | +class Liquidity_pool_update(GrapheneObject): |
| 1235 | + def __init__(self, *args, **kwargs): |
| 1236 | + if isArgsThisClass(self, args): |
| 1237 | + self.data = args[0].data |
| 1238 | + else: |
| 1239 | + if len(args) == 1 and len(kwargs) == 0: |
| 1240 | + kwargs = args[0] |
| 1241 | + |
| 1242 | + if kwargs.get("taker_fee_percent"): |
| 1243 | + taker_fee_percent = Optional(Uint16(kwargs["taker_fee_percent"])) |
| 1244 | + else: |
| 1245 | + taker_fee_percent = Optional(None) |
| 1246 | + |
| 1247 | + if kwargs.get("withdrawal_fee_percent"): |
| 1248 | + withdrawal_fee_percent = Optional( |
| 1249 | + Uint16(kwargs["withdrawal_fee_percent"]) |
| 1250 | + ) |
| 1251 | + else: |
| 1252 | + withdrawal_fee_percent = Optional(None) |
| 1253 | + |
| 1254 | + super().__init__( |
| 1255 | + OrderedDict( |
| 1256 | + [ |
| 1257 | + ("fee", Asset(kwargs["fee"])), |
| 1258 | + ("account", ObjectId(kwargs["account"], "account")), |
| 1259 | + ("pool", ObjectId(kwargs["pool"], "liquidity_pool")), |
| 1260 | + ("taker_fee_percent", taker_fee_percent), |
| 1261 | + ("withdrawal_fee_percent", withdrawal_fee_percent), |
| 1262 | + ("extensions", Set([])), |
| 1263 | + ] |
| 1264 | + ) |
| 1265 | + ) |
| 1266 | + |
| 1267 | + |
| 1268 | +class Credit_deal_update(GrapheneObject): |
| 1269 | + def __init__(self, *args, **kwargs): |
| 1270 | + if isArgsThisClass(self, args): |
| 1271 | + self.data = args[0].data |
| 1272 | + else: |
| 1273 | + if len(args) == 1 and len(kwargs) == 0: |
| 1274 | + kwargs = args[0] |
| 1275 | + super().__init__( |
| 1276 | + OrderedDict( |
| 1277 | + [ |
| 1278 | + ("fee", Asset(kwargs["fee"])), |
| 1279 | + ("account", ObjectId(kwargs["account"], "account")), |
| 1280 | + ("deal_id", ObjectId(kwargs["deal_id"], "credit_deal")), |
| 1281 | + ("auto_repay", Uint8(kwargs["auto_repay"])), |
| 1282 | + ("extensions", Set([])), |
| 1283 | + ] |
| 1284 | + ) |
| 1285 | + ) |
| 1286 | + |
| 1287 | + |
| 1288 | +class Limit_order_update(GrapheneObject): |
| 1289 | + def __init__(self, *args, **kwargs): |
| 1290 | + if isArgsThisClass(self, args): |
| 1291 | + self.data = args[0].data |
| 1292 | + else: |
| 1293 | + if len(args) == 1 and len(kwargs) == 0: |
| 1294 | + kwargs = args[0] |
| 1295 | + |
| 1296 | + if kwargs.get("new_price"): |
| 1297 | + new_price = Optional(Price(kwargs["new_price"])) |
| 1298 | + else: |
| 1299 | + new_price = Optional(None) |
| 1300 | + |
| 1301 | + if kwargs.get("delta_amount_to_sell"): |
| 1302 | + delta_amount_to_sell = Optional(Asset(kwargs["delta_amount_to_sell"])) |
| 1303 | + else: |
| 1304 | + delta_amount_to_sell = Optional(None) |
| 1305 | + |
| 1306 | + if kwargs.get("new_expiration"): |
| 1307 | + new_expiration = Optional(PointInTime(kwargs["new_expiration"])) |
| 1308 | + else: |
| 1309 | + new_expiration = Optional(None) |
| 1310 | + |
| 1311 | + if kwargs.get("on_fill"): |
| 1312 | + on_fill = Optional( |
| 1313 | + Array([LimitOrderAutoAction(o) for o in kwargs["on_fill"]]) |
| 1314 | + ) |
| 1315 | + else: |
| 1316 | + on_fill = Optional(None) |
| 1317 | + |
| 1318 | + super().__init__( |
| 1319 | + OrderedDict( |
| 1320 | + [ |
| 1321 | + ("fee", Asset(kwargs["fee"])), |
| 1322 | + ("seller", ObjectId(kwargs["seller"], "account")), |
| 1323 | + ("order", ObjectId(kwargs["order"], "limit_order")), |
| 1324 | + ("new_price", new_price), |
| 1325 | + ("delta_amount_to_sell", delta_amount_to_sell), |
| 1326 | + ("new_expiration", new_expiration), |
| 1327 | + ("on_fill", on_fill), |
| 1328 | + ("extensions", Set([])), |
| 1329 | + ] |
| 1330 | + ) |
| 1331 | + ) |
| 1332 | + |
| 1333 | + |
1229 | 1334 | fill_classmaps()
|
0 commit comments