Best Python code snippet using localstack_python
DormanPrins_lab2.py
Source:DormanPrins_lab2.py
...27 tk = tm.t128 t = tm.t029 y0 = tm.x030 tn = 031 y4 = np.empty(tm.get_order())32 y5 = np.empty(tm.get_order())33 y6 = np.empty(tm.get_order())34 bet = np.empty(6)35 while t < tk:36 self.k = np.resize(self.k, (1, tm.get_order()))37 hs = self.h38 temp = np.empty(tm.get_order())39 for i in range(len(y0)):40 temp[i] = y0[i]4142 self.k = np.row_stack((self.k, tm.get_right(temp, t)))43 self.k = np.delete(self.k, 0, 0)44 for i in range(tm.get_order()):45 temp[i] = y0[i] + self.h * self.a[1, 0] * self.k[0][i]4647 self.k = np.row_stack((self.k, tm.get_right(temp, t)))48 for i in range(tm.get_order()):49 temp[i] = y0[i] + self.h * (self.a[2, 0] * self.k[0][i] + self.a[2, 1] * self.k[1][i])5051 self.k = np.row_stack((self.k, tm.get_right(temp, t)))52 for i in range(tm.get_order()):53 temp[i] = y0[i] + self.h * (54 self.a[3, 0] * self.k[0][i] + self.a[3, 1] * self.k[1][i] + self.a[3, 2] * self.k[2, i])5556 self.k = np.row_stack((self.k, tm.get_right(temp, t)))57 for i in range(tm.get_order()):58 temp[i] = y0[i] + self.h * (59 self.a[4, 0] * self.k[0][i] + self.a[4, 1] * self.k[1][i] + self.a[4, 2] * self.k[2][i] + self.a[60 4, 3] * self.k[3][i])6162 self.k = np.row_stack((self.k, tm.get_right(temp, t)))63 for i in range(tm.get_order()):64 temp[i] = y0[i] + self.h * (65 self.a[5, 0] * self.k[0][i] + self.a[5, 1] * self.k[1][i] + self.a[5, 2] * self.k[2][i] + self.a[66 5, 3] * self.k[3][i] + self.a[5, 4] * self.k[4][i])6768 self.k = np.row_stack((self.k, tm.get_right(temp, t)))69 for i in range(tm.get_order()):70 temp[i] = y0[i] + self.h * (71 self.a[6, 0] * self.k[0][i] + self.a[6, 1] * self.k[1][i] + self.a[6, 2] * self.k[2][i] + self.a[72 6, 3] * self.k[3][i] + self.a[6, 4] * self.k[4][i] +73 self.a[6, 5] * self.k[5][i])7475 self.k = np.row_stack((self.k, tm.get_right(temp, t)))76 for i in range(tm.get_order()):77 y4[i] = y0[i] + self.h * (self.b[0] * self.k[0][i] +78 self.b[1] * self.k[1][i] + self.b[2] * self.k[2][i] + self.b[3] * self.k[3][79 i] +80 self.b[4] * self.k[4][i] + self.b[5] * self.k[5][i] + self.b[6] * self.k[6][81 i])82 y5[i] = y0[i] + self.h * (self.b1[0] * self.k[0][i] +83 self.b1[1] * self.k[1][i] + self.b1[2] * self.k[2][i] + self.b1[3] *84 self.k[3][i] +85 self.b1[4] * self.k[4][i] + self.b1[5] * self.k[5][i] + self.b1[6] *86 self.k[6][i])87 at = model.getsize(y0)88 sum = 089 for i in range(at - 1):90 nevepi = math.pow((self.h * (y4[i] - y5[i]) / max(max(1e-5, abs(y4[i])),91 max(abs(y0[i]), 2 * self.u / self.geps))), 2)92 sum += nevepi93 eps = math.sqrt(sum / at)94 self.h = self.h / max(0.1, min(5.0, (math.pow((eps / self.geps), 0.2) / 0.9)))95 if self.geps < eps:96 continue97 while (tn < t + hs) and (tn < tm.t1):98 teta = (tn - t) / hs99 bet[0] = teta * (1 + teta * (-1337 / 480 + teta * (1039 / 360 + teta * (-1163 / 1152))))100 bet[1] = 0101 bet[2] = 100 * math.pow(teta, 2) * (1054 / 9275 + teta * (-4682 / 27825 + teta * (379 / 5565))) / 3102 bet[3] = -5 * math.pow(teta, 2) * (27 / 40 + teta * (-9 / 5 + teta * (83 / 96))) / 2103 bet[4] = 18225 * math.pow(teta, 2) * (-3 / 250 + teta * (22 / 375 + teta * (-37 / 600))) / 848104 bet[5] = -22 * math.pow(teta, 2) * (-3 / 10 + teta * (29 / 30 + teta * (-17 / 24))) / 7105 for i in range(tm.get_order()):106 y6[i] = y0[i]107 for j in range(5):108 y6[i] = y6[i] + hs * bet[j] * self.k[j][i]109 tm.add_result(y6, tn)110 tn = tn + tm.sampling_increment111 t = t + hs112 y0 = np.empty(len(y4))113 for i in range(len(y4)):
...
api_kucoin.py
Source:api_kucoin.py
...30def USDT_AMPL_ETH_USDT(a, b, c):31 s = str(round(quantity/a, 2)) # FAZER COM 2 CASAS DECIMAIS32 order = client.create_limit_order(str(pairs[0]), Client.SIDE_BUY, a, size=s) # quantidade da moeda a comprar33 34 while(client.get_order(order['orderId'])['isActive'] == True):35 continue36 qq = float(client.get_order(order['orderId'])['size']) - float(client.get_order(order['orderId'])['fee'])37 qq = str(round(qq, 2))38 order1 = client.create_limit_order(pairs[1], Client.SIDE_SELL, b, qq)39 while(client.get_order(order1['orderId'])['isActive'] == True):40 continue41 qq1 = float(client.get_order(order1['orderId'])['size']) - float(client.get_order(order1['orderId'])['fee'])42 qq1 = str(round(qq1*b, 5))43 order2 = client.create_limit_order(pairs[2], Client.SIDE_SELL, c, qq1)44 print("Completed")45def USDT_ETH_AMPL_USDT(a, b, c):46 s = str(round(quantity/c,5))47 order = client.create_limit_order(pairs[2], Client.SIDE_BUY, c, size=s)48 while(client.get_order(order['orderId'])['isActive'] == True):49 continue50 qq = float(client.get_order(order['orderId'])['size']) - float(client.get_order(order['orderId'])['fee'])51 qq = str(round(qq/b,2)) 52 order1 = client.create_limit_order(pairs[1], Client.SIDE_BUY, b, qq)53 while(client.get_order(order1['orderId'])['isActive'] == True):54 continue55 qq1 = float(client.get_order(order1['orderId'])['size']) - float(client.get_order(order1['orderId'])['fee'])56 qq1 = str(round(qq1, 2))57 order2 = client.create_limit_order(pairs[0], Client.SIDE_SELL, a, qq1)58 print("Completed")59def prints(x, var, swag, swag1,a,b,c):60 print(date(var-460))61 print("balance: "+str(quantity))62 print(str(round(swag,5))+f" {coin}-USDT > {coin}-{pair}")63 64 print(str(round(swag1,5))+f" {coin}-USDT < {coin}-{pair}")65 vr = b * c66 print(f"{coin}-USDT: "+str(a)+f" {coin}-{pair}: "+str(b*c)+f" {pair}-USDT: "+str(c))67 68def sell_buy_sell(quantidade):69 var = int(client.get_timestamp()/1000)...
04-order-obj.py
Source:04-order-obj.py
1def initialize(context):2 context.us_stock = symbol('VTI')3def handle_data(context, data):4 o_object = order(symbol('AAPL'), 5)5 print get_order(o_object).status6 print get_order(o_object).created7 print get_order(o_object).stop8 print get_order(o_object).limit9 print get_order(o_object).amount10 print get_order(o_object).sid11 print get_order(o_object).filled12 print get_order(o_object).stop_reached13 print get_order(o_object).limit_reached14 print get_order(o_object).commission...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!