code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
import logging
LOG = logging.getLogger(__name__)
class DefaultOutputer(BaseModule):
''' Default feeder '''
def __init__(self):
''' constructor '''
super(DefaultOutputer, self... | ajibawa-2023/Python-Code-Large/train/row_81009 | 13 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81009:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.15, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81009:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81009:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 19, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import json, smtplib
import logging
LOG = logging.getLogger(__name__)
gmail_user = "your@gmail.com"
gmail_pwd = "y... | ajibawa-2023/Python-Code-Large/train/row_81010 | 33 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81010:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81010:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81010:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81010:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81010:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Co... |
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
from ultrafinance.lib.plotDateValueDict import PlotDateValueDict
import logging
LOG = logging.getLogger(__name__)
class PlotYearlyOutputer(BaseModule):
''' Default feeder '''
def __init__(sel... | ajibawa-2023/Python-Code-Large/train/row_81011 | 15 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81011:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1364, 0.2273, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81011:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81011:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81011:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81011:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" outputer package """ | ajibawa-2023/Python-Code-Large/train/row_81012 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81012:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Dec 18, 2010
@author: ppa
'''
import abc
from threading import Thread
from pydispatch.dispatcher import send
from ultrafinance.lib.util import deCapitalize
import logging
LOG = logging.getLogger(__name__)
class BaseModule(object):
'''
Base class for a feeder, processor and outpu... | ajibawa-2023/Python-Code-Large/train/row_81013 | 38 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81013:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0545, 0.0909, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81013:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81013:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81013:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81013:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Jan 30, 2011
@author: ppa
'''
from ultrafinance.lib.excelLib import ExcelLib
from ultrafinance.processChain.baseModule import BaseModule
from ultrafinance.lib.dataType import DateValueType
from os.path import join
import logging
LOG = logging.getLogger(__name__)
class IndexDataFeeder(Base... | ajibawa-2023/Python-Code-Large/train/row_81014 | 25 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81014:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0811, 0.1351, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81014:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81014:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81014:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81014:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2010
@author: ppa
'''
from datetime import date
from ultrafinance.lib.yahooFinance import YahooFinance
from ultrafinance.processChain.baseModule import BaseModule
import logging
LOG = logging.getLogger(__name__)
class HistoricalDataFeeder(BaseModule):
'''
feeder that ge... | ajibawa-2023/Python-Code-Large/train/row_81015 | 16 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81015:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1154, 0.1923, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81015:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81015:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81015:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81015:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 30, 2010
@author: ppa
'''
from ultrafinance.lib.excelLib import ExcelLib
from ultrafinance.processChain.baseModule import BaseModule
from ultrafinance.lib.dataType import DateValueType
from os.path import join
import logging
LOG = logging.getLogger(__name__)
class ExcelDataFeeder(Base... | ajibawa-2023/Python-Code-Large/train/row_81016 | 35 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81016:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0612, 0.102, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81016:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81016:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81016:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81016:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
import logging
LOG = logging.getLogger(__name__)
class DefaultFeeder(BaseModule):
''' Default feeder '''
def __init__(self):
''' Constructor '''
super(DefaultFeeder, self).__... | ajibawa-2023/Python-Code-Large/train/row_81017 | 14 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81017:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2381, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81017:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81017:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81017:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81017:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" feeder package """ | ajibawa-2023/Python-Code-Large/train/row_81018 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81018:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.pluginManager import PluginManager
from ultrafinance.processChain.configuration import Configuration
import threading
import time
import logging
LOG = logging.getLogger(__name__)
#TODO: use singleton pattern
class ProcessChain(... | ajibawa-2023/Python-Code-Large/train/row_81019 | 24 | 34 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81019:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0882, 0.1471, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81019:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81019:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81019:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81019:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2010
@author: ppa
'''
import ConfigParser
from os import path
import logging
LOG = logging.getLogger(__name__)
class Configuration(object):
''' class that handles configuration '''
def __init__(self, configFileName=None):
''' Constructor '''
if configFile... | ajibawa-2023/Python-Code-Large/train/row_81020 | 35 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81020:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.06, 0.1, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81020:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81020:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81020:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81020:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
import logging
LOG = logging.getLogger(__name__)
class DefaultProcessor(BaseModule):
def __init__(self):
''' constructor '''
super(DefaultProcessor, self).__init__()
def ex... | ajibawa-2023/Python-Code-Large/train/row_81021 | 12 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81021:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1579, 0.2632, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81021:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81021:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81021:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_81021:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Co... |
'''
Created on Feb 26, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
from ultrafinance.lib.tradingStrategyFactory import TradingStrategyFactory
from ultrafinance.lib.tradingStrategy.automaticInvestmentPlan import adjustFixAmountPerPeriod
from ultrafinance.lib.tradingStrategy... | ajibawa-2023/Python-Code-Large/train/row_81022 | 23 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81022:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0938, 0.1562, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81022:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81022:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81022:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81022:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" processor package """ | ajibawa-2023/Python-Code-Large/train/row_81023 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81023:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Dec 18, 2010
@author: ppa
'''
from ultrafinance.processChain.baseModule import BaseModule
from ultrafinance.lib.stockMeasurement import StockMeasurement
import logging
LOG = logging.getLogger(__name__)
class AvgDivProcessor(BaseModule):
''' Calculate average and standard deviation '''
... | ajibawa-2023/Python-Code-Large/train/row_81024 | 17 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81024:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.12, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81024:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81024:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81024:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81024:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 25, 2010
@author: ppa
'''
import os
import fnmatch
from pydispatch.dispatcher import connect, send
from ultrafinance.lib.util import import_class, splitByComma
import logging
LOG = logging.getLogger(__name__)
class PluginManager(object):
''' plugin manager that init and run all... | ajibawa-2023/Python-Code-Large/train/row_81025 | 65 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81025:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0323, 0.0538, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81025:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81025:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81025:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81025:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
''' processChain ''' | ajibawa-2023/Python-Code-Large/train/row_81026 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81026:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Jan 3, 2011
@author: ppa
'''
import copy
import numpy
from ultrafinance.lib.yahooFinance import YahooFinance
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger(__name__)
class StockMeasurement():
''' measurement of a single stock/index ''... | ajibawa-2023/Python-Code-Large/train/row_81027 | 62 | 90 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81027:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.0556, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81027:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81027:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81027:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81027:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Feb 20, 2011
@author: ppa
'''
from matplotlib import pyplot
import math
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger(__name__)
class PlotPortfolio(object):
''' plot portfolio curve. only two are supported '''
def __init__(self, la... | ajibawa-2023/Python-Code-Large/train/row_81028 | 32 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81028:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0577, 0.0962, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81028:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81028:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81028:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81028:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 30, 2011
@author: ppa
'''
from xlrd import open_workbook
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger(__name__)
class ExcelLib():
''' lib for aceesing excel '''
def __init__(self, fileName=None, sheetNumber=0, sheetName=None):
... | ajibawa-2023/Python-Code-Large/train/row_81029 | 43 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81029:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.037, 0.0617, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81029:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81029:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81029:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81029:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Feb 5, 2011
@author: ppa
'''
from collections import namedtuple
DateValueType = namedtuple('DateValue', 'date, value')
StockDailyType = namedtuple('StockDailyType', 'date, open, high, low, close, volume, adjClose')
| ajibawa-2023/Python-Code-Large/train/row_81030 | 4 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81030:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Mar 20, 2011
@author: ppa
'''
from datetime import date
from xlwt import Workbook
import time
import traceback
from ultrafinance.lib.errors import UfException, Errors
from ultrafinance.lib.yahooFinance import YahooFinance
import logging
LOG = logging.getLogger(__name__)
class Historic... | ajibawa-2023/Python-Code-Large/train/row_81031 | 48 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81031:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.0667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81031:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81031:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81031:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81031:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on May 6, 2011
@author: ppa
'''
import traceback
class Errors(object):
""" class hosts error code constants """
# general errors
UNKNOWN_ERROR = 1
NETWORK_ERROR = 100
NETWORK_400_ERROR = 101
INDEX_RANGE_ERROR = 200
STOCK_SYMBOL_ERROR = 300
STOCK_PARSING_ERROR = 301
... | ajibawa-2023/Python-Code-Large/train/row_81032 | 33 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81032:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0556, 0.0926, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81032:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81032:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81032:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81032:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
'''
Created on Dec 21, 2010
@author: ppa
Thanks to Corey Goldberg, this module is based http://www.goldb.org/ystockquote.html
sample usage:
>>> import YahooFinance
>>> print YahooFinance.get_price('GOOG')
529.46
'''
import urllib
import traceback
from operator import itemgetter
from ultrafinance.lib.dat... | ajibawa-2023/Python-Code-Large/train/row_81033 | 91 | 156 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81033:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0385, 0.0705, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81033:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81033:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81033:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_81033:Try_L23_C8"}, {"f": "ajibawa-2023/Python-Cod... |
'''
Created on July 31, 2011
@author: ppa
'''
import urllib2
from BeautifulSoup import BeautifulSoup
import traceback
from operator import itemgetter
from ultrafinance.lib.util import convertGoogCSVDate, findPatthen
from ultrafinance.lib.dataType import StockDailyType
from ultrafinance.lib.errors import UfE... | ajibawa-2023/Python-Code-Large/train/row_81034 | 83 | 166 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81034:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0181, 0.0301, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81034:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81034:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81034:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_81034:Try_L22_C8"}, {"f": "ajibawa-2023/Python-Cod... |
'''
Created on Feb 26, 2011
@author: ppa
'''
import logging
LOG = logging.getLogger(__name__)
def fixAmountPerPeriod(dateValues, interval):
''' fix amount investment for each time period'''
amount = float(100)
share = sum([amount/dateValues[index].value for index in range(len(dateValues)/interv... | ajibawa-2023/Python-Code-Large/train/row_81035 | 27 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81035:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.075, 0.125, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81035:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81035:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81035:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81035:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
''' trading strategy '''
import os, sys
mainSrc = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(mainSrc) | ajibawa-2023/Python-Code-Large/train/row_81036 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81036:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Mar 27, 2011
@author: ppa
'''
from datetime import date
from operator import itemgetter
from ultrafinance.lib.excelLib import ExcelLib
import logging
LOG = logging.getLogger(__name__)
class TradeInWeek():
'''
trade in one week. Which day to buy and sell is best
'''
WEEK... | ajibawa-2023/Python-Code-Large/train/row_81037 | 36 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81037:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0536, 0.0893, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81037:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81037:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81037:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81037:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Feb 26, 2011
@author: ppa
'''
from ultrafinance.lib.errors import UfException, Errors
import traceback
import logging
LOG = logging.getLogger()
class TradingStrategyFactory():
''' Factory method for trading Strategies '''
def __init__(self, strategy):
''' constructor '''
... | ajibawa-2023/Python-Code-Large/train/row_81038 | 13 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81038:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.12, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81038:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81038:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81038:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81038:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2010
@author: ppa
'''
import sys
from BeautifulSoup import BeautifulSoup
from datetime import datetime
import time
import logging
LOG = logging.getLogger()
googCSVDateformat = "%d-%b-%y"
def import_class(path, fileName, className=None):
''' dynamically import class '''
... | ajibawa-2023/Python-Code-Large/train/row_81039 | 47 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81039:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0758, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81039:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81039:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81039:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81039:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
'''
Created on May 6, 2011
@author: ppa
'''
import traceback
class Errors(object):
""" class hosts error code constants """
# general errors
UNKNOWN_ERROR = 1
FILE_NOT_EXIST = 2
FILE_EXIST = 3
UNDEFINED_METHOD = 4
NETWORK_ERROR = 100
NETWORK_400_ERROR = 101
INDEX_RANGE_ERROR = 20... | ajibawa-2023/Python-Code-Large/train/row_81040 | 51 | 79 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81040:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.038, 0.0633, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81040:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81040:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81040:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81040:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
'''
Created on Sep 27, 2011
@author: ppa
'''
import sys
from thrift import Thrift
from thrift.transport import TSocket, TTransport
from thrift.protocol import TBinaryProtocol
from hbase import ttypes
from hbase.Hbase import Client, ColumnDescriptor, Mutation
from ultrafinance.lib.errors import UfExcepti... | ajibawa-2023/Python-Code-Large/train/row_81041 | 78 | 133 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81041:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0226, 0.0376, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81041:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81041:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81041:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81041:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-... |
''' ultraFinance lib '''
import os, sys
import logging
LOG = logging.getLogger(__name__)
'''
mainSrc = os.path.join(os.path.dirname( (os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(mainSrc)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s.%(msecs)03d %(leveln... | ajibawa-2023/Python-Code-Large/train/row_81042 | 5 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81042:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
'''
Created on Jan 3, 2011
@author: ppa
'''
from matplotlib import pyplot
from datetime import datetime
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger(__name__)
class PlotDateValueDict(object):
''' plot dict with date value '''
def __init__(self, ... | ajibawa-2023/Python-Code-Large/train/row_81043 | 40 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81043:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.05, 0.0833, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81043:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81043:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81043:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81043:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Apr 24, 2011
@author: ppa
'''
from operator import itemgetter
import time
import os
from ultrafinance.lib.stockMeasurement import StockMeasurement
from ultrafinance.lib.historicalDataStorage import HistoricalDataStorage
from ultrafinance.lib.yahooFinance import YahooFinance
from ultrafinanc... | ajibawa-2023/Python-Code-Large/train/row_81044 | 83 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81044:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0252, 0.042, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81044:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81044:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81044:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81044:For_L27_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'interestHoursingStock.ini'
runProcessChain(configFile1) | ajibawa-2023/Python-Code-Large/train/row_81045 | 5 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81045:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81045:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81045:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81045:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81045:Expr_L10_C4"}] |
'''
Created on July 18, 2010
@author: ppa
'''
from ultrafinance.lib.tradingStrategy.tradeInWeek import TradeInWeek
from ultrafinance.lib.historicalDataStorage import HistoricalDataStorage
from os.path import join, dirname, abspath
if __name__ == '__main__':
outputPrefix = join(dirname(dirname(abspath(__... | ajibawa-2023/Python-Code-Large/train/row_81046 | 12 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81046:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.2778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81046:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81046:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81046:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81046:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'usTradingStrategy.ini'
runProcessChain(configFile1) | ajibawa-2023/Python-Code-Large/train/row_81047 | 5 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81047:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81047:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81047:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81047:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81047:Expr_L10_C4"}] |
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'historicalStock.ini'
runProcessChain(configFile1)
| ajibawa-2023/Python-Code-Large/train/row_81048 | 5 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81048:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81048:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81048:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81048:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81048:Expr_L10_C4"}] |
""" unittest package """
import os, sys
mainSrc = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'ultrafinance')
sys.path.append(mainSrc) | ajibawa-2023/Python-Code-Large/train/row_81049 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81049:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
""" test package """ | ajibawa-2023/Python-Code-Large/train/row_81050 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81050:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Sep 27, 2011
@author: ppa
'''
from thrift.transport import TSocket, TTransport
from thrift.protocol import TBinaryProtocol
from hbase import ttypes
from hbase.Hbase import Client, ColumnDescriptor, Mutation
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = loggi... | ajibawa-2023/Python-Code-Large/train/row_81051 | 83 | 138 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81051:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0217, 0.0362, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81051:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81051:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81051:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81051:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
class DAMFactory(object):
''' DAM factory '''
@staticmethod
def createDAM(damType, settings = None):
''' create DAM '''
if 'yahoo' == damType:
from ultrafinance.da... | ajibawa-2023/Python-Code-Large/train/row_81052 | 26 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81052:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1282, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81052:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81052:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81052:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81052:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
'''
Created on Nov 9, 2011
@author: ppa
'''
import abc
from ultrafinance.lib.errors import UfException, Errors
class BaseDAM(object):
''' base class for DAO '''
__metaclass__ = abc.ABCMeta
def __init__(self):
''' constructor '''
self.__symbol = None
def readQuotes(sel... | ajibawa-2023/Python-Code-Large/train/row_81053 | 38 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81053:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0694, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81053:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81053:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81053:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81053:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.dam.googleFinance import GoogleFinance
import logging
LOG = logging.getLogger()
class GoogleDAM(BaseDAM):
''' Google DAO '''
def __init__(self):
''' constructor '''
supe... | ajibawa-2023/Python-Code-Large/train/row_81054 | 29 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81054:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.119, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81054:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81054:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81054:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81054:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 30, 2011
@author: ppa
'''
from xlrd import open_workbook
from xlwt import Workbook
from ultrafinance.lib.errors import UfException, Errors
from os import path
import logging
LOG = logging.getLogger()
class ExcelLib(object):
''' lib for accessing excel '''
READ_MODE = 'r'
... | ajibawa-2023/Python-Code-Large/train/row_81055 | 137 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81055:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.014, 0.0233, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81055:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81055:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81055:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81055:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.dam.excelLib import ExcelLib
from ultrafinance.model import TICK_FIELDS, QUOTE_FIELDS, Quote, Tick
from ultrafinance.lib.errors import UfException, Errors
from os import path
import logging
LOG = l... | ajibawa-2023/Python-Code-Large/train/row_81056 | 66 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81056:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0303, 0.0505, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81056:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81056:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81056:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81056:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Dec 21, 2010
@author: ppa
Thanks to Corey Goldberg, this module is based http://www.goldb.org/ystockquote.html
sample usage:
>>> import YahooFinance
>>> print YahooFinance.get_price('GOOG')
529.46
'''
import urllib
import traceback
from ultrafinance.model import Quote
from ultrafinance.li... | ajibawa-2023/Python-Code-Large/train/row_81057 | 50 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81057:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0632, 0.1158, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81057:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81057:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81057:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_81057:Try_L22_C8"}, {"f": "ajibawa-2023/Python-Cod... |
'''
Created on July 31, 2011
@author: ppa
'''
import urllib2
from bs4 import BeautifulSoup
import traceback
from ultrafinance.lib.util import convertGoogCSVDate
from ultrafinance.model import Quote, Tick
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger()
c... | ajibawa-2023/Python-Code-Large/train/row_81058 | 98 | 218 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81058:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0138, 0.0229, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81058:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81058:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81058:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81058:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Cod... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.model import Quote, Tick, TupleQuote
from ultrafinance.lib.util import splitListEqually
import sys
from sqlalchemy import Column, Integer, String, Float, Sequence, create_engine, and_
from sqlalchemy.... | ajibawa-2023/Python-Code-Large/train/row_81059 | 222 | 320 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81059:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0094, 0.0156, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81059:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81059:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81059:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81059:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
''' data access module ''' | ajibawa-2023/Python-Code-Large/train/row_81060 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81060:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.dam.yahooFinance import YahooFinance
import logging
LOG = logging.getLogger()
class YahooDAM(BaseDAM):
''' Yahoo DAM '''
def __init__(self):
''' constructor '''
super(Ya... | ajibawa-2023/Python-Code-Large/train/row_81061 | 17 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81061:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1154, 0.1923, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81061:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81061:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81061:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81061:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.dam.hbaseLib import HBaseLib
from ultrafinance.model import Quote, Tick, TICK_FIELDS, QUOTE_FIELDS
from hbase.Hbase import Mutation, ColumnDescriptor
class HBaseDAM(BaseDAM):
''' HBase DAO '''
... | ajibawa-2023/Python-Code-Large/train/row_81062 | 63 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81062:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.033, 0.0549, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81062:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81062:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81062:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81062:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on July 31, 2011
@author: ppa
copyied from http://code.activestate.com/recipes/131499-observer-pattern/
Not sure whether it's a good idea to remove observer class
'''
class Observable:
''' class for observer design pattern '''
def __init__(self):
''' constructor '''
sel... | ajibawa-2023/Python-Code-Large/train/row_81063 | 19 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81063:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1452, 0.2581, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81063:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81063:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81063:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81063:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
''' design patterns ''' | ajibawa-2023/Python-Code-Large/train/row_81065 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81065:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on May 26, 2012
@author: ppa
'''
import logging
LOG = logging.getLogger()
class History(object):
''' helper class providing history info '''
INDEX = "I"
def __init__(self):
''' constructor '''
self.timeSymbolTick = {}
def update(self, timeStamp, symbolTickDict, indexTick)... | ajibawa-2023/Python-Code-Large/train/row_81066 | 16 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81066:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1154, 0.1923, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81066:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81066:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81066:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81066:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
'''
Created on Apr 29, 2012
@author: ppa
'''
import abc
from ultrafinance.pyTaLib.indicator import stddev, sharpeRatio, mean, rsquared
class BaseMetric(object):
''' base metric class '''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def calculate(self, timePositions):
''' keep record of the... | ajibawa-2023/Python-Code-Large/train/row_81067 | 89 | 129 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81067:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0233, 0.0388, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81067:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81067:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81067:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81067:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.backTest.constant import EVENT_TICK_UPDATE, EVENT_ORDER_EXECUTED
from ultrafinance.backTest.constant import STATE_SAVER_UPDATED_ORDERS, STATE_SAVER_PLACED_ORDERS
from threading import Thread
from time import sleep
import json
import logging
LOG = logging.... | ajibawa-2023/Python-Code-Large/train/row_81068 | 118 | 182 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81068:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0165, 0.0275, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81068:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81068:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81068:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81068:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.model import Type, Action
from ultrafinance.lib.errors import Errors, UfException
import uuid
import logging
LOG = logging.getLogger()
class Account(object):
''' account '''
def __init__(self, cash, commision):
''' constructor '''
... | ajibawa-2023/Python-Code-Large/train/row_81069 | 136 | 194 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81069:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0155, 0.0258, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81069:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81069:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81069:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81069:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 18, 2011
@author: ppa
'''
from ultrafinance.model import Action, Type, Order
from ultrafinance.lib.errors import Errors, UfException
import uuid
import time
import logging
LOG = logging.getLogger()
class TradingCenter(object):
'''
trading center
Note: set metricNames before adding acco... | ajibawa-2023/Python-Code-Large/train/row_81070 | 136 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81070:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.0248, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81070:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81070:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81070:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81070:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 6, 2012
@author: ppa
'''
import re
OUTPUT_PREFIX = 'output'
OUTPUT_FIELDS = ['placedOrder', 'accountValue', 'executedOrder']
def findInListbyRe(itemList, reString):
''' find items in list by re '''
items = []
pair = re.compile(reString)
for item in itemList:
result = pair.... | ajibawa-2023/Python-Code-Large/train/row_81071 | 13 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81071:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2381, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81071:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81071:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81071:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81071:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.lib.errors import UfException, Errors
from threading import Thread
from ultrafinance.backTest.appGlobal import appGlobal
from ultrafinance.backTest.constant import TRADE_TYPE, TICK, QUOTE
from ultrafinance.backTest.constant import STATE_SAVER_INDEX_PRICE
... | ajibawa-2023/Python-Code-Large/train/row_81072 | 97 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81072:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0197, 0.0329, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81072:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81072:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81072:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81072:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.designPattern.singleton import Singleton
import logging
LOG = logging.getLogger()
class StateSaverFactory(Singleton):
''' factory for output saver '''
@staticmethod
def createStateSaver(n... | ajibawa-2023/Python-Code-Large/train/row_81073 | 14 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81073:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.12, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81073:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81073:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81073:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81073:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Mar 1, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.backTest.stateSaver import StateSaver
from ultrafinance.model import Order
from sqlalchemy import Table, Column, Integer, String, create_engine, MetaData, and_, select
from sqlalchemy.ext.declarative ... | ajibawa-2023/Python-Code-Large/train/row_81074 | 163 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81074:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0115, 0.0192, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81074:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81074:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81074:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81074:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.dam.hbaseLib import HBaseLib
from ultrafinance.backTest.stateSaver import StateSaver
from hbase.Hbase import Mutation, ColumnDescriptor
import logging
LOG = logging.getLogger()
class HbaseSaver(State... | ajibawa-2023/Python-Code-Large/train/row_81075 | 50 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81075:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0385, 0.0641, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81075:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81075:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81075:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81075:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
import abc
import logging
LOG = logging.getLogger()
class StateSaver(object):
''' state saver '''
__metaclass__ = abc.ABCMeta
def __init__(self):
''' constructor '''
self.__tableName = Non... | ajibawa-2023/Python-Code-Large/train/row_81076 | 27 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81076:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.06, 0.1, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81076:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81076:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81076:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81076:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Jan 29, 2011
@author: ppa
'''
from ultrafinance.backTest.account import Account
from ultrafinance.backTest.constant import STATE_SAVER_ACCOUNT, STATE_SAVER_HOLDING_VALUE
import copy
import logging
LOG = logging.getLogger()
class AccountManager(object):
'''
account manager
Note: set metric... | ajibawa-2023/Python-Code-Large/train/row_81077 | 43 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81077:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0462, 0.0769, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81077:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81077:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81077:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81077:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 24, 2012
@author: ppa
'''
from ultrafinance.designPattern.singleton import Singleton
class AppGlobal(dict, Singleton):
''' appGlobal class '''
def __init__(self):
super(AppGlobal, self).__init__()
appGlobal = AppGlobal.getInstance()
| ajibawa-2023/Python-Code-Large/train/row_81078 | 7 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81078:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81078:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81078:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81078:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81078:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
""" backtest package """
| ajibawa-2023/Python-Code-Large/train/row_81079 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81079:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Nov 6, 2011
@author: ppa
'''
import abc
import uuid
import threading
class TickSubsriber(object):
''' tick subscriber '''
__metaclass__ = abc.ABCMeta
def __init__(self, name):
''' constructor '''
self.__id = self.__generateId()
self.__name = name
... | ajibawa-2023/Python-Code-Large/train/row_81080 | 36 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81080:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0526, 0.0877, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81080:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81080:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81080:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81080:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Dec 26, 2011
@author: ppa
'''
from ultrafinance.backTest.tickSubscriber.strategies.periodStrategy import PeriodStrategy
from ultrafinance.backTest.tickSubscriber.strategies.smaStrategy import SMAStrategy
from ultrafinance.backTest.tickSubscriber.strategies.smaPortfolioStrategy import SMAPortfolioStrate... | ajibawa-2023/Python-Code-Large/train/row_81081 | 17 | 34 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81081:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0882, 0.1471, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81081:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81081:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81081:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81081:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on July 08, 2013
This strategy leverage 10/50/200 days Simple Moving Average(SMA) as short/mid/long term trend
When to Sell:
1 when stop order is hit
2 if the 10 < 50 or 10 < 200, place sell order
Stop order:
1 when buy order is placed, set stop order to be 5%
2 as time goes, increase stop price to be m... | ajibawa-2023/Python-Code-Large/train/row_81082 | 125 | 248 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81082:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 25], "level": 0, "parent": null, "vector": [8, 0, 0.0524, 0.1008, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81082:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81082:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81082:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81082:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 09, 2013
This strategy use zscore to trade stocks
When to Buy/Short:
if zsocore is > 2
When to Sell/Buy to cover:
1 after 10 days
2 or stop order is met(5%)
@author: ppa
'''
from ultrafinance.model import Type, Action, Order
from ultrafinance.backTest.tickSubscriber.strategies.baseStrategy import... | ajibawa-2023/Python-Code-Large/train/row_81083 | 96 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81083:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 14], "level": 0, "parent": null, "vector": [8, 0, 0.0507, 0.0946, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81083:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81083:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81083:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81083:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 25, 2011
@author: ppa
'''
import abc
from ultrafinance.backTest.tickSubscriber import TickSubsriber
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.backTest.constant import EVENT_TICK_UPDATE, EVENT_ORDER_EXECUTED
import logging
LOG = logging.getLogger()
class BaseStrategy... | ajibawa-2023/Python-Code-Large/train/row_81084 | 41 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81084:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0758, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81084:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81084:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81084:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81084:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Nov 09, 2013
This strategy use zscore to trade stocks
When to Buy/Short:
if zsocore is > 2.5
When to Sell/Buy to cover:
1 after 10 days
2 or stop order is met(5%)
@author: ppa
'''
from ultrafinance.model import Type, Action, Order
from ultrafinance.backTest.tickSubscriber.strategies.baseStrategy impo... | ajibawa-2023/Python-Code-Large/train/row_81085 | 91 | 156 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81085:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 14], "level": 0, "parent": null, "vector": [8, 0, 0.0481, 0.0897, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81085:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81085:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81085:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81085:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on July 08, 2013
This strategy leverage 10/50/200 days Simple Moving Average(SMA) as short/mid/long term trend
When to Sell:
1 when stop order is hit
2 if the 10 < 50 or 10 < 200, place sell order
Stop order:
1 when buy order is placed, set stop order to be 5%
2 as time goes, increase stop price to be m... | ajibawa-2023/Python-Code-Large/train/row_81086 | 155 | 285 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81086:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 25], "level": 0, "parent": null, "vector": [8, 0, 0.0456, 0.0877, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81086:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81086:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81086:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81086:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-... |
''' strategy ''' | ajibawa-2023/Python-Code-Large/train/row_81087 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81087:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on Dec 25, 2011
@author: ppa
'''
from ultrafinance.model import Type, Action, Order
from ultrafinance.backTest.tickSubscriber.strategies.baseStrategy import BaseStrategy
from ultrafinance.backTest.constant import CONF_STRATEGY_PERIOD, CONF_INIT_CASH
import logging
LOG = logging.getLogger()
class PeriodSt... | ajibawa-2023/Python-Code-Large/train/row_81088 | 27 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81088:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0588, 0.098, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81088:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81088:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81088:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81088:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Jan 20, 2012
@author: ppa
'''
#config constant
CONF_APP_MAIN = 'app_main'
CONF_ULTRAFINANCE_SECTION = 'ultrafinance'
CONF_TRADE_TYPE = 'backtest.tradetype'
CONF_SYMBOL_FILE = 'backtest.symbolfile'
CONF_INDEX = 'backtest.index'
CONF_INIT_CASH = "backtest.initcash"
CONF_INPUT_DAM = 'backtest.input_dam... | ajibawa-2023/Python-Code-Large/train/row_81089 | 34 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81089:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0588, 0.098, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
'''
Created on May 26, 2012
@author: ppa
'''
import logging
LOG = logging.getLogger()
class IndexHelper(object):
''' helper class providing index info '''
def __init__(self):
''' constructor '''
self.__tick = []
def appendTick(self, tick):
''' self current tick '''
self._... | ajibawa-2023/Python-Code-Large/train/row_81090 | 13 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81090:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2381, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81090:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81090:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81090:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81090:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
'''
Created on Nov 30, 2010
@author: ppa
'''
import ConfigParser
from os import path
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger()
class PyConfig(object):
''' class that handles configuration '''
def __init__(self):
''' Constructor '''... | ajibawa-2023/Python-Code-Large/train/row_81091 | 64 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81091:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0532, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81091:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81091:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81091:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81091:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
''' config module ''' | ajibawa-2023/Python-Code-Large/train/row_81092 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81092:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on May 26, 2012
@author: ppa
'''
import numpy
from numpy import polyval, polyfit
from math import sqrt
from collections import deque
from scipy import stats
def mean(array):
''' average '''
return numpy.mean(array, axis = 0)
def stddev(array):
''' Standard Deviation '''
r... | ajibawa-2023/Python-Code-Large/train/row_81093 | 121 | 208 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81093:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0144, 0.024, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81093:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81093:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81093:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81093:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" talib python impl""" | ajibawa-2023/Python-Code-Large/train/row_81094 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81094:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
'''
Created on April 15, 2012
@author: Bruno Franca
'''
import numpy
from pandas import *
from math import *
#Moving Average
def MA(df, n):
MA = Series(rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
return df
#Exponential Moving Average
def EMA(df, n):
EMA = Se... | ajibawa-2023/Python-Code-Large/train/row_81095 | 297 | 360 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81095:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0083, 0.0139, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81095:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81095:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81095:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81095:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Co... |
'''
Created on Dec 4, 2011
@author: ppa
'''
from ultrafinance.dam.DAMFactory import DAMFactory
from os import path
import time
from threading import Thread
from threading import Lock
import logging
LOG = logging.getLogger()
THREAD_TIMEOUT = 5
MAX_TRY = 3
class GoogleCrawler(object):
''' collect quotes/ticks ... | ajibawa-2023/Python-Code-Large/train/row_81096 | 74 | 117 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81096:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0256, 0.0427, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81096:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81096:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81096:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81096:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 3, 2011
@author: ppa
'''
from ultrafinance.backTest.tickSubscriber.strategies.strategyFactory import StrategyFactory
from ultrafinance.backTest.tradingCenter import TradingCenter
from ultrafinance.backTest.tickFeeder import TickFeeder
from ultrafinance.backTest.tradingEngine import TradingEngine
fr... | ajibawa-2023/Python-Code-Large/train/row_81097 | 183 | 256 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81097:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0117, 0.0195, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81097:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81097:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81097:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81097:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-... |
''' high level module that can be used directly ''' | ajibawa-2023/Python-Code-Large/train/row_81098 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81098:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
""" ultrafinance package """
import os, re, sys
import logging
LOG = logging.getLogger()
# library paths
"""
LIB = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'lib')
for entry in os.listdir(LIB):
filePath = os.path.join(LIB, entry)
if os.path.isfile(filePath) and re.search(r".*\.... | ajibawa-2023/Python-Code-Large/train/row_81099 | 5 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81099:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
'''
Created on Dec 18, 2010
@author: ppa
'''
import sys
from bs4 import BeautifulSoup
from datetime import datetime
from datetime import timedelta
from datetime import date
import time
from time import gmtime, strftime
import logging
LOG = logging.getLogger()
googCSVDateformat = "%d-%b-%y"
def imp... | ajibawa-2023/Python-Code-Large/train/row_81100 | 75 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81100:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0288, 0.0481, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81100:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81100:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81100:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81100:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
'''
Created on May 6, 2011
@author: ppa
'''
import traceback
class Errors(object):
""" class hosts error code constants """
# general errors
UNKNOWN_ERROR = 1
FILE_NOT_EXIST = 2
FILE_EXIST = 3
UNDEFINED_METHOD = 4
NETWORK_ERROR = 100
NETWORK_400_ERROR = 101
INDEX_RANGE_ERROR = 20... | ajibawa-2023/Python-Code-Large/train/row_81101 | 57 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81101:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0345, 0.0575, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81101:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81101:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81101:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81101:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
''' ultraFinance lib '''
import os, sys
import logging
LOG = logging.getLogger(__name__)
'''
mainSrc = os.path.join(os.path.dirname( (os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(mainSrc)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s.%(msecs)03d %(leveln... | ajibawa-2023/Python-Code-Large/train/row_81102 | 5 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81102:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
'''
Created on Jan 3, 2011
@author: ppa
'''
from matplotlib import pyplot
from datetime import datetime
from ultrafinance.lib.errors import UfException, Errors
import logging
LOG = logging.getLogger()
class PlotDateValueDict(object):
''' plot dict with date value '''
def __init__(self, dateValu... | ajibawa-2023/Python-Code-Large/train/row_81103 | 40 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81103:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0492, 0.082, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81103:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81103:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81103:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81103:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Nov 6, 2011
@author: ppa
'''
import json
from collections import namedtuple
from ultrafinance.lib.errors import UfException, Errors
# namedtuple are used to handle data getting from csv or internet
TICK_FIELDS = ['time', 'open', 'high', 'low', 'close', 'volume']
#QUOTE_FIELDS = ['time', 'open', 'high',... | ajibawa-2023/Python-Code-Large/train/row_81104 | 116 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81104:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.0248, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81104:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81104:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81104:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81104:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on July 4, 2011
@author: ppa
copied from http://da44en.wordpress.com/2002/11/22/using-distutils/
'''
from distutils.core import Command
from unittest import TextTestRunner, TestLoader
from glob import glob
from os.path import splitext, basename, join as pjoin
import os
class TestCommand(Comman... | ajibawa-2023/Python-Code-Large/train/row_81105 | 36 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81105:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0603, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81105:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81105:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81105:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81105:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
'''
Created on Dec 3, 2011
@author: ppa
'''
from ultrafinance.module.backTester import BackTester
if __name__ == "__main__":
backTester = BackTester("backtest_smaPortfolio.ini", startTickDate = 20101010, startTradeDate = 20111220)
backTester.setup()
backTester.runTests()
backTester.printMetrics()
| ajibawa-2023/Python-Code-Large/train/row_81106 | 7 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81106:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2308, 0.3846, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81106:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81106:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81106:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81106:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_811... |
'''
Created on Aug 11, 2011
@author: ppa
'''
import os
import sys
from ultrafinance.lib.googleFinance import GoogleFinance
class StockPicker:
''' sort stocks '''
def __init__(self):
''' constructor '''
self.__workingDir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspat... | ajibawa-2023/Python-Code-Large/train/row_81107 | 64 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81107:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0306, 0.051, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81107:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81107:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81107:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81107:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
'''
Created on Dec 4, 2011
@author: ppa
'''
from ultrafinance.module.googleCrawler import GoogleCrawler
from os import path
import datetime
from dateutil.relativedelta import relativedelta
import optparse
BATCH_SIZE = 30
THREAD_TIMEOUT = 5
MAX_TRY = 3
class StockCrawler(object):
''' collect quotes/ticks for a l... | ajibawa-2023/Python-Code-Large/train/row_81108 | 48 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81108:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0694, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_81108:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81108:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_81108:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_81108:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" application package """
import os, sys
mainSrc = os.path.dirname(os.path.abspath(__file__))
sys.path.append(mainSrc)
| ajibawa-2023/Python-Code-Large/train/row_81109 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_81109:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.