How to use symbol_name method in avocado

Best Python code snippet using avocado_python

chart_code_size.py

Source:chart_code_size.py Github

copy

Full Screen

1# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)2#3# SPDX-License-Identifier: MIT4# This script renders a graph of the CircuitPython rom image.5# It takes the single elf file and uses objdump to get its contents.6import pygraphviz as pgv7import click8import sh9# Replace dashes with underscores10objdump = sh.arm_none_eabi_objdump11def parse_hex(h):12 return int("0x" + h, 0)13BAD_JUMPS = ["UNPREDICTABLE", "_etext"]14SPECIAL_NODE_COLORS = {"main": "pink", "exception_table": "green"}15@click.command()16@click.argument("elf_filename")17def do_all_the_things(elf_filename):18 symbol = None19 last_address = 020 all_symbols = {}21 symbols_by_debug_address = {}22 symbols_by_memory_address = {}23 symbols_by_linkage_name = {}24 # Gather type info so we know how to treat the disassembly25 debug_dump = objdump("--dwarf=info", elf_filename)26 debug_dump_lines = debug_dump.stdout.decode("utf-8").split("\n")27 symbol_stack = []28 symbol = None29 ignore = False30 min_call_site_param = 0x2000000031 for line in debug_dump_lines:32 if not line:33 continue34 parts = line.split()35 if line[1] == "<":36 if parts[-1] == "0":37 symbol = symbol_stack.pop()38 continue39 debug_type = parts[-1].strip("()")40 ignore = False41 # skip info about function parameters42 if debug_type == "DW_TAG_formal_parameter":43 ignore = True44 depth = int(parts[0].split(">")[0].strip("<"))45 if len(symbol_stack) == (depth - 1) and depth > 0:46 symbol_stack.append(symbol)47 elif symbol and "name" in symbol:48 if symbol["debug_type"] == "DW_TAG_variable":49 if "start_address" not in symbol:50 pass51 else:52 symbols_by_memory_address[symbol["start_address"]] = symbol53 elif symbol["debug_type"] in [54 "DW_TAG_member",55 "DW_TAG_label",56 "DW_TAG_typedef",57 "DW_TAG_enumerator",58 "DW_TAG_enumeration_type",59 "DW_TAG_base_type",60 "DW_TAG_structure_type",61 "DW_TAG_compile_unit",62 "DW_TAG_union_type",63 ]:64 # skip symbols that don't end up in memory. the type info is available through the debug address map65 pass66 else:67 if symbol["name"] in all_symbols:68 # print(depth, symbol["name"])69 # print(symbol)70 # print(all_symbols[symbol["name"]])71 # print()72 pass73 all_symbols[symbol["name"]] = symbol74 elif (75 symbol76 and symbol["debug_type"] == "DW_TAG_GNU_call_site_parameter"77 and "call_site_value" in symbol78 ):79 parent = -180 while symbol_stack[parent]["debug_type"] != "DW_TAG_subprogram":81 parent -= 182 parent = symbol_stack[parent]83 # Only point to ROM84 addr = symbol["call_site_value"]85 if 0x2000 <= addr < 0x20000000:86 if "outgoing_pointers" not in parent:87 parent["outgoing_pointers"] = set()88 parent["outgoing_pointers"].add(addr)89 if addr not in symbols_by_memory_address:90 symbols_by_memory_address[addr] = symbol91 min_call_site_param = min(addr, min_call_site_param)92 symbol["name"] = "name{:x}".format(addr)93 address = parse_hex(parts[0].split("<")[-1].strip(">:"))94 symbol = {"debug_address": address, "debug_type": debug_type, "other": []}95 if debug_type == "DW_TAG_structure_type":96 symbol["struct"] = {}97 elif debug_type == "DW_TAG_array_type":98 symbol["subtype"] = None99 symbol["bound_count"] = 0100 symbol["maxlen"] = 0101 elif debug_type == "DW_TAG_subrange_type":102 symbol_stack[-1]["subtype"] = symbol103 symbols_by_debug_address[address] = symbol104 elif ignore:105 continue106 elif line[:4] == " ":107 tag = parts[1].strip(":")108 if tag == "DW_AT_name":109 symbol["name"] = parts[-1]110 elif tag == "DW_AT_type":111 symbol["type"] = int(parts[-1].strip("<>"), 0)112 if symbol["debug_type"] == "DW_TAG_subrange_type":113 if not symbol_stack[-1]["subtype"]:114 symbol_stack[-1]["subtype"] = symbol115 elif symbol_stack[-1]["subtype"]["type"] == symbol["type"]:116 second_subtype = True117 else:118 raise RuntimeError()119 elif tag == "DW_AT_upper_bound":120 # Skip arrays with length defined by other variables121 if parts[-1][0] != "<":122 upper_bound = int(parts[-1])123 if symbol_stack[-1]["bound_count"] > 0:124 symbol_stack[-1]["maxlen"] *= upper_bound + 1125 else:126 symbol_stack[-1]["maxlen"] = upper_bound + 1127 symbol_stack[-1]["bound_count"] += 1128 elif tag == "DW_AT_byte_size":129 symbol["size"] = int(parts[-1])130 elif tag == "DW_AT_inline":131 symbol["inlined"] = True132 elif tag == "DW_AT_low_pc":133 addr = int(parts[-1], 0)134 symbols_by_memory_address[addr] = symbol135 elif tag == "DW_AT_location":136 if parts[-2] == "(DW_OP_addr:":137 addr = parse_hex(parts[-1].strip(")"))138 if addr > 0:139 symbol["start_address"] = addr140 elif tag == "DW_AT_linkage_name":141 symbol["linkage_name"] = parts[-1]142 symbols_by_linkage_name[symbol["linkage_name"]] = symbol143 elif tag == "DW_AT_data_member_location":144 symbol_stack[-1]["struct"][int(parts[-1])] = symbol145 elif tag == "DW_AT_GNU_call_site_value":146 if parts[-2] == "(DW_OP_addr:":147 symbol["call_site_value"] = parse_hex(parts[-1].strip(")"))148 else:149 symbol["other"].append(line)150 # print(parts)151 pass152 else:153 # print(line)154 pass155 MEMORY_NONE = 0156 MEMORY_POINTER = 1157 MEMORY_PY_OBJECT = 2158 def get_size(t):159 if "size" in t:160 return t["size"]161 return get_size(symbols_by_debug_address[t["type"]])162 def get_pointer_map(t, depth=0):163 if t["debug_type"] == "DW_TAG_pointer_type":164 return {0: MEMORY_POINTER}165 elif t["debug_type"] in [166 "DW_TAG_const_type",167 "DW_TAG_typedef",168 "DW_TAG_member",169 "DW_TAG_subrange_type",170 "DW_TAG_volatile_type",171 ]:172 if "name" in t and t["name"] == "mp_rom_obj_t":173 return {0: MEMORY_PY_OBJECT}174 return get_pointer_map(symbols_by_debug_address[t["type"]], depth + 1)175 elif t["debug_type"] in ["DW_TAG_base_type", "DW_TAG_enumeration_type"]:176 return {}177 elif t["debug_type"] == "DW_TAG_union_type":178 # skip for now179 return {}180 elif "struct" in t:181 combined_map = {}182 for offset in t["struct"]:183 member = t["struct"][offset]184 submap = get_pointer_map(member)185 for suboffset in submap:186 combined_map[offset + suboffset] = submap[suboffset]187 return combined_map188 elif "subtype" in t:189 subtype = symbols_by_debug_address[t["type"]]190 pmap = get_pointer_map(subtype, depth + 1)191 size = get_size(subtype)192 expanded_map = {}193 for i in range(t["maxlen"]):194 for offset in pmap:195 expanded_map[size * i + offset] = pmap[offset]196 return expanded_map197 else:198 print("no recurse", t)199 pass200 return {}201 # Do a second pass to dereference the types202 for symbol_address in symbols_by_memory_address:203 symbol = symbols_by_memory_address[symbol_address]204 if "type" in symbol:205 if symbol["debug_type"] == "DW_TAG_variable":206 symbol["pointer_map"] = get_pointer_map(symbols_by_debug_address[symbol["type"]])207 type_string = []208 t = symbol["type"]209 offset = []210 while t != None:211 t_symbol = symbols_by_debug_address[t]212 t = t_symbol.get("type", None)213 if "name" in t_symbol:214 type_string.append(t_symbol["name"])215 elif t_symbol["debug_type"] == "DW_TAG_array_type":216 type_string.append("[]")217 elif t_symbol["debug_type"] == "DW_TAG_pointer_type":218 type_string.append("*")219 elif t_symbol["debug_type"] == "DW_TAG_const_type":220 type_string.append("const")221 elif t_symbol["debug_type"] == "DW_TAG_volatile_type":222 type_string.append("volatile")223 else:224 # print(" ", t_symbol)225 pass226 type_string.reverse()227 symbol["type_string"] = " ".join(type_string)228 # print(symbol_name, symbol["debug_type"], symbol.get("type_string", ""))229 # print()230 # print()231 # print(all_symbols["mp_builtin_module_table"])232 # return233 # Gather size and call info234 text_dump = objdump("-Dz", "-j", ".text", elf_filename)235 text_dump_lines = text_dump.stdout.decode("utf-8").split("\n")236 section = None237 symbol = None238 symbol_type = None239 for line in text_dump_lines[4:]:240 if line.startswith("Disassembly of section"):241 section = line.split()[-1].strip(":")242 elif not line:243 if symbol and "end_address" not in symbol:244 symbol["end_address"] = last_address245 symbol["size"] = last_address - symbol["start_address"]246 symbol = None247 continue248 elif line[0].isnumeric():249 symbol_address, symbol_name = line.split()250 symbol_address = parse_hex(symbol_address)251 symbol_name = symbol_name.strip("<>:")252 if symbol_name in symbols_by_linkage_name:253 linked_name = symbol_name254 symbol = symbols_by_linkage_name[symbol_name]255 if "name" in symbol:256 non_linkage = symbol["name"]257 if not non_linkage.startswith("__builtin"):258 symbol_name = non_linkage259 all_symbols[symbol_name] = symbol260 if "name" not in symbol:261 symbol["name"] = symbol_name262 elif symbol_address in symbols_by_memory_address:263 all_symbols[symbol_name] = symbols_by_memory_address[symbol_address]264 if "name" not in all_symbols[symbol_name]:265 all_symbols[symbol_name]["name"] = symbol_name266 elif symbol_name not in all_symbols:267 if symbol_name == "nlr_push_tail_var":268 fake_type = all_symbols["mp_obj_get_type"]["type"]269 symbol = {270 "debug_type": "DW_TAG_variable",271 "name": symbol_name,272 "type": fake_type,273 }274 else:275 print(line)276 print(symbol_name, symbol_address)277 symbol = {"debug_type": "DW_TAG_subprogram", "name": symbol_name}278 all_symbols[symbol_name] = symbol279 # raise RuntimeError()280 symbol = all_symbols[symbol_name]281 symbol["start_address"] = symbol_address282 symbols_by_memory_address[symbol_address] = symbol283 symbol["section"] = section284 if symbol["debug_type"] == "DW_TAG_subprogram":285 symbol["outgoing_jumps"] = set()286 symbol["incoming_jumps"] = set()287 symbol_type = None288 elif symbol["debug_type"] == "DW_TAG_variable":289 symbol["outgoing_pointers"] = set()290 symbol_type = symbols_by_debug_address[symbol["type"]]291 all_symbols[symbol_name] = symbol292 elif line[0] == " ":293 parts = line.strip().split()294 last_address = parse_hex(parts[0].strip(":"))295 offset = last_address - symbol["start_address"]296 if "pointer_map" in symbol:297 if offset not in symbol["pointer_map"]:298 # print(offset, symbol)299 pass300 else:301 ref = parse_hex(parts[1])302 pointer_style = symbol["pointer_map"][offset]303 if pointer_style == MEMORY_POINTER:304 symbol["outgoing_pointers"].add(ref & 0xFFFFFFFE)305 elif pointer_style == MEMORY_PY_OBJECT and ref & 0x3 == 0:306 symbol["outgoing_pointers"].add(ref)307 if len(parts[1]) == 8 and parts[1][0] == "0":308 addr = parse_hex(parts[1])309 if 0x2000 <= addr < 0x20000000:310 if "outgoing_pointers" not in symbol:311 symbol["outgoing_pointers"] = set()312 symbol["outgoing_pointers"].add(addr)313 elif "<" in line and symbol["debug_type"] == "DW_TAG_subprogram":314 if line[-1] == ">":315 jump_to = parts[-1].strip("<>").split("+")[0]316 if "name" not in symbol:317 print(jump_to)318 print(symbol)319 if jump_to != symbol["name"] and jump_to not in BAD_JUMPS:320 symbol["outgoing_jumps"].add(jump_to)321 # print(symbol_name, jump_to)322 if jump_to == "_etext":323 print(line)324 elif "UNDEFINED" in line:325 continue326 elif parts[2] == "ldr":327 continue328 else:329 print(line)330 else:331 # print(line)332 pass333 # print()334 print(hex(min_call_site_param))335 print(all_symbols["exception_table"])336 # return337 print("converting outgoing pointers to names")338 # Convert outgoing pointers to names from addresses339 for symbol_name in all_symbols:340 symbol = all_symbols[symbol_name]341 if "outgoing_pointers" not in symbol:342 continue343 converted = set()344 for outgoing in symbol["outgoing_pointers"]:345 if outgoing in symbols_by_memory_address:346 outgoing = symbols_by_memory_address[outgoing]347 # print(outgoing)348 if outgoing["debug_type"] in ["DW_TAG_GNU_call_site", "DW_TAG_lexical_block"]:349 continue350 if outgoing["name"] == "audioio_wavefile_type":351 print(outgoing)352 converted.add(outgoing["name"])353 symbol["outgoing_pointers"] = converted354 print("linking back")355 # Link back356 for symbol_name in all_symbols:357 symbol = all_symbols[symbol_name]358 if "outgoing_jumps" in symbol:359 for outgoing in symbol["outgoing_jumps"]:360 if outgoing not in all_symbols:361 # print(outgoing, symbol_name)362 continue363 # print(all_symbols[outgoing], symbol_name)364 referenced_symbol = all_symbols[outgoing]365 if "incoming_jumps" not in referenced_symbol:366 # print(symbol_name, "->", outgoing)367 referenced_symbol["incoming_jumps"] = set()368 referenced_symbol["incoming_jumps"].add(symbol_name)369 if "outgoing_pointers" in symbol:370 for outgoing in symbol["outgoing_pointers"]:371 if outgoing not in all_symbols:372 # print(outgoing, symbol_name)373 continue374 # print(all_symbols[outgoing], symbol_name)375 referenced_symbol = all_symbols[outgoing]376 if "incoming_pointers" not in referenced_symbol:377 # print(symbol_name, "->", outgoing)378 referenced_symbol["incoming_pointers"] = set()379 referenced_symbol["incoming_pointers"].add(symbol_name)380 print(all_symbols["exception_table"])381 # Chart it all382 print("charting {} symbols".format(len(all_symbols)))383 callgraph = pgv.AGraph(directed=True)384 for i, symbol_name in enumerate(all_symbols):385 symbol = all_symbols[symbol_name]386 # print(i, symbol_name)387 # if "outgoing_jumps" in symbol:388 # print(" ", len(symbol["outgoing_jumps"]), "jumps")389 # if "outgoing_pointers" in symbol:390 # print(" ", len(symbol["outgoing_pointers"]), "ptrs")391 # if i > 3000:392 # break393 if ("incoming_jumps" not in symbol or len(symbol["incoming_jumps"]) == 0) and (394 "incoming_pointers" not in symbol or len(symbol["incoming_pointers"]) == 0395 ):396 # print(symbol_name)397 continue398 if "start_address" not in symbol:399 continue400 callgraph.add_node(symbol_name)401 if "outgoing_jumps" in symbol:402 for outgoing in symbol["outgoing_jumps"]:403 callgraph.add_edge(symbol_name, outgoing)404 if "outgoing_pointers" in symbol:405 for outgoing in symbol["outgoing_pointers"]:406 callgraph.add_edge(symbol_name, outgoing, color="red")407 # print(symbol_name, symbol)408 # Style all of the nodes409 print("styling")410 for node in callgraph.iternodes():411 if node.name not in all_symbols:412 continue413 symbol = all_symbols[node.name]414 node.attr["shape"] = "box"415 text_width_ish = len(node.name) * 0.1416 if "size" not in symbol:417 print(symbol)418 size = symbol["size"] / 8419 square_size = size ** 0.5420 if text_width_ish > square_size:421 w = text_width_ish422 h = size / text_width_ish423 else:424 w = square_size425 h = square_size426 node.attr["width"] = w427 node.attr["height"] = h428 node.attr["label"] = node.name + "\r\n" + str(symbol["size"]) + " bytes"429 node.attr["style"] = "filled"430 incoming = 0431 if "incoming_jumps" in symbol:432 incoming += len(symbol["incoming_jumps"])433 if "incoming_pointers" in symbol:434 incoming += len(symbol["incoming_pointers"])435 if node.name in SPECIAL_NODE_COLORS:436 node.attr["color"] = SPECIAL_NODE_COLORS[node.name]437 elif incoming == 1:438 node.attr["color"] = "lightblue"439 elif incoming > 25:440 print("delete", node.name, "because it has {} incoming".format(incoming))441 callgraph.delete_node(node.name)442 elif incoming > 15:443 node.attr["color"] = "red"444 print("drawing")445 callgraph.layout(prog="dot")446 fn = "callgraph.svg"447 print(fn)448 callgraph.draw(fn)449if __name__ == "__main__":...

Full Screen

Full Screen

oe_broker.py

Source:oe_broker.py Github

copy

Full Screen

...41 XLM = "0.10000000"42 ZEN = "0.00100000"43 ZRX = "0.01000000"44 @staticmethod45 def get_decimal_with_symbol_name(symbol_name):46 symbol_name = symbol_name # type: str47 symbol_name = symbol_name.upper()48 if symbol_name == "AAVE":49 return Broker.SymbolDecimals.AAVE50 if symbol_name == "ADA":51 return Broker.SymbolDecimals.ADA52 if symbol_name == "ATOM":53 return Broker.SymbolDecimals.ATOM54 if symbol_name == "AVAX":55 return Broker.SymbolDecimals.AVAX56 if symbol_name == "AXS":57 return Broker.SymbolDecimals.AXS58 if symbol_name == "BAND":59 return Broker.SymbolDecimals.BAND60 if symbol_name == "BAT":61 return Broker.SymbolDecimals.BAT62 if symbol_name == "BCH":63 return Broker.SymbolDecimals.BCH64 if symbol_name == "BNB":65 return Broker.SymbolDecimals.BNB66 if symbol_name == "BTC":67 return Broker.SymbolDecimals.BTC68 if symbol_name == "COMP":69 return Broker.SymbolDecimals.COMP70 if symbol_name == "CRV":71 return Broker.SymbolDecimals.CRV72 if symbol_name == "CTSI":73 return Broker.SymbolDecimals.CTSI74 if symbol_name == "DOGE":75 return Broker.SymbolDecimals.DOGE76 if symbol_name == "DOT":77 return Broker.SymbolDecimals.DOT78 if symbol_name == "EGLD":79 return Broker.SymbolDecimals.EGLD80 if symbol_name == "ETC":81 return Broker.SymbolDecimals.ETC82 if symbol_name == "ETH":83 return Broker.SymbolDecimals.ETH84 if symbol_name == "FIL":85 return Broker.SymbolDecimals.FIL86 if symbol_name == "HNT":87 return Broker.SymbolDecimals.HNT88 if symbol_name == "KNC":89 return Broker.SymbolDecimals.KNC90 if symbol_name == "LTC":91 return Broker.SymbolDecimals.LTC92 if symbol_name == "MKR":93 return Broker.SymbolDecimals.MKR94 if symbol_name == "NEO":95 return Broker.SymbolDecimals.NEO96 if symbol_name == "ONE":97 return Broker.SymbolDecimals.ONE98 if symbol_name == "ONT":99 return Broker.SymbolDecimals.ONT100 if symbol_name == "OXT":101 return Broker.SymbolDecimals.ONT102 if symbol_name == "QTUM":103 return Broker.SymbolDecimals.QTUM104 if symbol_name == "SOL":105 return Broker.SymbolDecimals.SOL106 if symbol_name == "STORJ":107 return Broker.SymbolDecimals.STORJ108 if symbol_name == "UNI":109 return Broker.SymbolDecimals.UNI110 if symbol_name == "VET":111 return Broker.SymbolDecimals.VET112 if symbol_name == "VTHO":113 return Broker.SymbolDecimals.VTHO114 if symbol_name == "XLM":115 return Broker.SymbolDecimals.XLM116 if symbol_name == "ZEN":117 return Broker.SymbolDecimals.ZEN118 if symbol_name == "ZRX":119 return Broker.SymbolDecimals.ZRX120 def get_symbol_decimals(self, symbol):121 string = Broker.SymbolDecimals.get_decimal_with_symbol_name(symbol)122 decimal = 0123 is_the_decimal = False124 for char in string:125 if is_the_decimal:126 decimal += 1127 if char == '1':128 break129 if char == '.':130 is_the_decimal = True131 return decimal132 def order_send_to_broker(self, _client, side, quantity, symbol_name, order_type=ORDER_TYPE_MARKET):133 order_info = self.OrderInfo()134 try:135 quantity = round(quantity, self.get_symbol_decimals(symbol_name))...

Full Screen

Full Screen

quantity_zero.py

Source:quantity_zero.py Github

copy

Full Screen

...36 XLM = "0.10000000"37 ZEN = "0.00100000"38 ZRX = "0.01000000"39 @staticmethod40 def get_decimal_with_symbol_name(symbol_name):41 symbol_name = symbol_name # type: str42 symbol_name = symbol_name.upper()43 if symbol_name == "AAVE":44 return Broker.SymbolDecimals.AAVE45 if symbol_name == "ADA":46 return Broker.SymbolDecimals.ADA47 if symbol_name == "ATOM":48 return Broker.SymbolDecimals.ATOM49 if symbol_name == "AVAX":50 return Broker.SymbolDecimals.AVAX51 if symbol_name == "AXS":52 return Broker.SymbolDecimals.AXS53 if symbol_name == "BAND":54 return Broker.SymbolDecimals.BAND55 if symbol_name == "BAT":56 return Broker.SymbolDecimals.BAT57 if symbol_name == "BCH":58 return Broker.SymbolDecimals.BCH59 if symbol_name == "BNB":60 return Broker.SymbolDecimals.BNB61 if symbol_name == "BTC":62 return Broker.SymbolDecimals.BTC63 if symbol_name == "COMP":64 return Broker.SymbolDecimals.COMP65 if symbol_name == "CRV":66 return Broker.SymbolDecimals.CRV67 if symbol_name == "CTSI":68 return Broker.SymbolDecimals.CTSI69 if symbol_name == "DOGE":70 return Broker.SymbolDecimals.DOGE71 if symbol_name == "DOT":72 return Broker.SymbolDecimals.DOT73 if symbol_name == "EGLD":74 return Broker.SymbolDecimals.EGLD75 if symbol_name == "ETC":76 return Broker.SymbolDecimals.ETC77 if symbol_name == "ETH":78 return Broker.SymbolDecimals.ETH79 if symbol_name == "FIL":80 return Broker.SymbolDecimals.FIL81 if symbol_name == "HNT":82 return Broker.SymbolDecimals.HNT83 if symbol_name == "KNC":84 return Broker.SymbolDecimals.KNC85 if symbol_name == "LTC":86 return Broker.SymbolDecimals.LTC87 if symbol_name == "MKR":88 return Broker.SymbolDecimals.MKR89 if symbol_name == "NEO":90 return Broker.SymbolDecimals.NEO91 if symbol_name == "ONE":92 return Broker.SymbolDecimals.ONE93 if symbol_name == "ONT":94 return Broker.SymbolDecimals.ONT95 if symbol_name == "OXT":96 return Broker.SymbolDecimals.ONT97 if symbol_name == "QTUM":98 return Broker.SymbolDecimals.QTUM99 if symbol_name == "SOL":100 return Broker.SymbolDecimals.SOL101 if symbol_name == "STORJ":102 return Broker.SymbolDecimals.STORJ103 if symbol_name == "UNI":104 return Broker.SymbolDecimals.UNI105 if symbol_name == "VET":106 return Broker.SymbolDecimals.VET107 if symbol_name == "VTHO":108 return Broker.SymbolDecimals.VTHO109 if symbol_name == "XLM":110 return Broker.SymbolDecimals.XLM111 if symbol_name == "ZEN":112 return Broker.SymbolDecimals.ZEN113 if symbol_name == "ZRX":114 return Broker.SymbolDecimals.ZRX115 @staticmethod116 def get_symbol_decimals(symbol):117 string = Broker.SymbolDecimals.get_decimal_with_symbol_name(symbol)118 decimal = 0119 is_the_decimal = False120 for char in string:121 if is_the_decimal:122 decimal += 1123 if char == '1':124 break125 if char == '.':126 is_the_decimal = True127 return decimal128usd = 250129price = 0.006821130quantity = usd / price131print(quantity)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful