(self, isBuy: bool, amountString: str, priceString: str, params={})
| 2370 | return account |
| 2371 | |
| 2372 | def create_order_settlement_data(self, isBuy: bool, amountString: str, priceString: str, params={}): |
| 2373 | totalFee = self.safe_string(params, 'totalFee') |
| 2374 | settlementExpiration = self.safe_integer(params, 'settlementExpiration') |
| 2375 | nonce = self.safe_integer(params, 'nonce') |
| 2376 | starkKey = self.safe_string(params, 'starkKey') |
| 2377 | collateralPosition = self.safe_string(params, 'collateralPosition') |
| 2378 | syntheticId = self.safe_string(params, 'syntheticId') |
| 2379 | collateralId = self.safe_string(params, 'collateralId') |
| 2380 | syntheticResolution = self.safe_integer(params, 'syntheticResolution') |
| 2381 | collateralResolution = self.safe_integer(params, 'collateralResolution') |
| 2382 | quoteAmount = Precise.string_mul(amountString, priceString) |
| 2383 | baseRoundUp = isBuy |
| 2384 | quoteRoundUp = isBuy |
| 2385 | baseAmount = self.get_extended_stark_amount(amountString, syntheticResolution, baseRoundUp) |
| 2386 | collateralAmount = self.get_extended_stark_amount(quoteAmount, collateralResolution, quoteRoundUp) |
| 2387 | if isBuy: |
| 2388 | collateralAmount = Precise.string_neg(collateralAmount) |
| 2389 | else: |
| 2390 | baseAmount = Precise.string_neg(baseAmount) |
| 2391 | feeAmount = self.get_extended_stark_amount(Precise.string_mul(totalFee, quoteAmount), collateralResolution, True) |
| 2392 | settlement = { |
| 2393 | 'starkKey': starkKey, |
| 2394 | 'collateralPosition': collateralPosition, |
| 2395 | 'baseAssetId': syntheticId, |
| 2396 | 'baseAmount': baseAmount, |
| 2397 | 'quoteAssetId': collateralId, |
| 2398 | 'quoteAmount': collateralAmount, |
| 2399 | 'feeAssetId': collateralId, |
| 2400 | 'feeAmount': feeAmount, |
| 2401 | 'expiration': self.number_to_string(settlementExpiration), |
| 2402 | 'salt': nonce, |
| 2403 | } |
| 2404 | msgHash = self.get_extended_order_msg_hash(settlement) |
| 2405 | sig = json.loads(self.extended_starknet_sign(msgHash, self.privateKey)) |
| 2406 | r = self.get_extended_signature_hex(sig[0]) |
| 2407 | s = self.get_extended_signature_hex(sig[1]) |
| 2408 | settlement['r'] = r |
| 2409 | settlement['s'] = s |
| 2410 | return settlement |
| 2411 | |
| 2412 | def create_withdrawal_settlement_data(self, address: str, amountString: str, currency: Currency, account: dict, params={}): |
| 2413 | now = self.milliseconds() |
no test coverage detected