Best Python code snippet using pandera_python
machine_learning.py
Source:machine_learning.py
...124 return None125 else:126 logger.info('%d series ignored due to insufficient data' % (np.size(data, 1) - np.size(in_sample_data, 1)))127 out_of_sample_data = data.loc[out_of_sample.index, in_sample_data.columns]128 return self.strategy_component(asset_returns=asset_returns, in_sample_data=in_sample_data,129 out_of_sample_data=out_of_sample_data, params=params, model=model)130 def run_without_cross_validation(self, in_sample, out_of_sample):131 data = self.create_estimation_data(self.default_params)132 return self.estimate_model(in_sample, out_of_sample, data, self.default_params)133 def run_cross_validation(self, in_sample, out_of_sample):134 seq = mu.get_cross_validation_buckets(len(in_sample), self.cross_validation_buckets)135 selection = None136 error_rate = 100.137 idx = 0138 error_trace = []139 for i, param in enumerate(self.cross_validation_params):140 logger.info('Running on %s [%d of %d]' % (str(param), i+1, len(self.cross_validation_params)))141 errors = []142 validation_param = self.default_params.copy()...
root_component.py
Source:root_component.py
1import tkinter as tk2import logging3from connectors.binance_futures import BinanceFuturesClient4from interface.styling import *5from interface.logging_component import Logging6from interface.watchlist_component import Watchlist7from interface.trades_component import TradesWatch8from interface.strategy_component import StrategyEditor9logger = logging.getLogger()10class Root(tk.Tk):11 def __init__(self, binance: BinanceFuturesClient):12 super().__init__()13 self.binance = binance14 self.title("Trading Bot")15 self.configure(bg=BG_COLOR)16 self._left_frame = tk.Frame(self, bg=BG_COLOR)17 self._left_frame.pack(side=tk.LEFT)18 # side note this one is also placed to the left but AFTER the left frame which has precedence because it came19 # first in the code20 self._right_frame = tk.Frame(self, bg=BG_COLOR)21 self._right_frame.pack(side=tk.LEFT)22 self._watchlist_frame = Watchlist(self.binance.contracts, self._left_frame, bg=BG_COLOR)23 self._watchlist_frame.pack(side=tk.TOP)24 self.logging_frame = Logging(self._left_frame, bg=BG_COLOR)25 self.logging_frame.pack(side=tk.TOP)26 self._strategy_frame = StrategyEditor(self.binance, self._right_frame, bg=BG_COLOR)27 self._strategy_frame.pack(side=tk.TOP)28 self._trades_frame = TradesWatch(self._right_frame, bg=BG_COLOR)29 self._trades_frame.pack(side=tk.TOP)30 # This was to test the logging window31 # self._logging_frame.add_log("This is a test message.")32 self._update_ui()33 def _update_ui(self):34 # Logs35 for log in self.binance.logs:36 if not log['displayed']:37 self.logging_frame.add_log(log['log'])38 log['displayed'] = True39 # Watchlist prices40 try:41 for key, value in self._watchlist_frame.body_widgets['symbol'].items():42 symbol = self._watchlist_frame.body_widgets['symbol'][key].cget("text")43 exchange = self._watchlist_frame.body_widgets['exchange'][key].cget("text")44 if exchange == "Binance":45 if symbol not in self.binance.contracts:46 # continue means skipping this element of the loop and going to the next one47 continue48 precision = self.binance.contracts[symbol].price_decimals49 if symbol not in self.binance.prices:50 self.binance.get_bid_ask(self.binance.contracts[symbol])51 continue52 prices = self.binance.prices[symbol]53 else:54 continue55 if prices['bid'] is not None:56 price_str = "{0: .{prec}f}".format(prices['bid'], prec=precision)57 self._watchlist_frame.body_widgets['bid_var'][key].set(price_str)58 if prices['ask'] is not None:59 price_str = "{0: .{prec}f}".format(prices['ask'], prec=precision)60 self._watchlist_frame.body_widgets['ask_var'][key].set(price_str)61 except RuntimeError as e:62 logger.error("Error while looping through the watchlist dictionary: %s", e)...
__init__.py
Source:__init__.py
1from . import generic_component2from . import strategy_component3from . import tactic_component4from .generic_component import *5from .strategy_component import *...
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!!