code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'interestHoursingStock.ini'
runProcessChain(configFile1) | [
[
8,
0,
0.3,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6,
0.1,
0,
0.66,
0.5,
446,
0,
1,
0,
0,
446,
0,
0
],
[
4,
0,
0.9,
0.3,
0,
0.66,
1,
0,
0... | [
"'''\nCreated on July 17, 2010\n\n@author: ppa\n'''",
"from ultrafinance.processChain.processChain import runProcessChain",
"if __name__ == '__main__':\n configFile1 = 'interestHoursingStock.ini'\n runProcessChain(configFile1)",
" configFile1 = 'interestHoursingStock.ini'",
" runProcessChain(con... |
'''
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(__... | [
[
8,
0,
0.1667,
0.2778,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3333,
0.0556,
0,
0.66,
0.25,
363,
0,
1,
0,
0,
363,
0,
0
],
[
1,
0,
0.3889,
0.0556,
0,
0.66,
... | [
"'''\nCreated on July 18, 2010\n\n@author: ppa\n'''",
"from ultrafinance.lib.tradingStrategy.tradeInWeek import TradeInWeek",
"from ultrafinance.lib.historicalDataStorage import HistoricalDataStorage",
"from os.path import join, dirname, abspath",
"if __name__ == '__main__':\n outputPrefix = join(dirname... |
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'usTradingStrategy.ini'
runProcessChain(configFile1) | [
[
8,
0,
0.3,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6,
0.1,
0,
0.66,
0.5,
446,
0,
1,
0,
0,
446,
0,
0
],
[
4,
0,
0.9,
0.3,
0,
0.66,
1,
0,
0... | [
"'''\nCreated on July 17, 2010\n\n@author: ppa\n'''",
"from ultrafinance.processChain.processChain import runProcessChain",
"if __name__ == '__main__':\n configFile1 = 'usTradingStrategy.ini'\n runProcessChain(configFile1)",
" configFile1 = 'usTradingStrategy.ini'",
" runProcessChain(configFile1... |
'''
Created on July 17, 2010
@author: ppa
'''
from ultrafinance.processChain.processChain import runProcessChain
if __name__ == '__main__':
configFile1 = 'historicalStock.ini'
runProcessChain(configFile1)
| [
[
8,
0,
0.3,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6,
0.1,
0,
0.66,
0.5,
446,
0,
1,
0,
0,
446,
0,
0
],
[
4,
0,
0.9,
0.3,
0,
0.66,
1,
0,
0... | [
"'''\nCreated on July 17, 2010\n\n@author: ppa\n'''",
"from ultrafinance.processChain.processChain import runProcessChain",
"if __name__ == '__main__':\n configFile1 = 'historicalStock.ini'\n runProcessChain(configFile1)",
" configFile1 = 'historicalStock.ini'",
" runProcessChain(configFile1)"
] |
""" 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) | [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.3333,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"\"\"\" 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)"
] |
""" test package """ | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\" test package \"\"\""
] |
'''
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... | [
[
8,
0,
0.0217,
0.0362,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0435,
0.0072,
0,
0.66,
0.1111,
269,
0,
2,
0,
0,
269,
0,
0
],
[
1,
0,
0.0507,
0.0072,
0,
0.66... | [
"'''\nCreated on Sep 27, 2011\n\n@author: ppa\n'''",
"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",
"im... |
'''
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... | [
[
8,
0,
0.0769,
0.1282,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1795,
0.0256,
0,
0.66,
0.5,
55,
0,
2,
0,
0,
55,
0,
0
],
[
3,
0,
0.6154,
0.7949,
0,
0.66,
... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"from ultrafinance.lib.errors import Errors, UfException",
"class DAMFactory(object):\n ''' DAM factory '''\n @staticmethod\n def createDAM(damType, settings = None):\n ''' create DAM '''\n if 'yahoo' == damType:\n from ultraf... |
'''
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... | [
[
8,
0,
0.0526,
0.0877,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1053,
0.0175,
0,
0.66,
0.3333,
38,
0,
1,
0,
0,
38,
0,
0
],
[
1,
0,
0.1228,
0.0175,
0,
0.66,
... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"import abc",
"from ultrafinance.lib.errors import UfException, Errors",
"class BaseDAM(object):\n ''' base class for DAO '''\n __metaclass__ = abc.ABCMeta\n\n def __init__(self):\n ''' constructor '''\n self.__symbol = None",
" '... |
'''
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... | [
[
8,
0,
0.0714,
0.119,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0238,
0,
0.66,
0.2,
742,
0,
1,
0,
0,
742,
0,
0
],
[
1,
0,
0.1667,
0.0238,
0,
0.66,
... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"from ultrafinance.dam.baseDAM import BaseDAM",
"from ultrafinance.dam.googleFinance import GoogleFinance",
"import logging",
"LOG = logging.getLogger()",
"class GoogleDAM(BaseDAM):\n ''' Google DAO '''\n\n def __init__(self):\n ''' construc... |
'''
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'
... | [
[
8,
0,
0.014,
0.0233,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0279,
0.0047,
0,
0.66,
0.1,
785,
0,
1,
0,
0,
785,
0,
0
],
[
1,
0,
0.0326,
0.0047,
0,
0.66,
... | [
"'''\nCreated on Jan 30, 2011\n\n@author: ppa\n'''",
"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):\n ''' lib for accessing excel... |
'''
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... | [
[
8,
0,
0.0303,
0.0505,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0606,
0.0101,
0,
0.66,
0.125,
742,
0,
1,
0,
0,
742,
0,
0
],
[
1,
0,
0.0707,
0.0101,
0,
0.66,... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"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",
... |
'''
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... | [
[
8,
0,
0.0632,
0.1158,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1263,
0.0105,
0,
0.66,
0.1429,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.1368,
0.0105,
0,
0.66... | [
"'''\nCreated on Dec 21, 2010\n\n@author: ppa\n\nThanks to Corey Goldberg, this module is based http://www.goldb.org/ystockquote.html\nsample usage:\n>>> import YahooFinance",
"import urllib",
"import traceback",
"from ultrafinance.model import Quote",
"from ultrafinance.lib.errors import UfException, Error... |
'''
Created on July 31, 2011
@author: ppa
'''
import urllib2
from BeautifulSoup 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.getLog... | [
[
8,
0,
0.014,
0.0233,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0279,
0.0047,
0,
0.66,
0.1111,
345,
0,
1,
0,
0,
345,
0,
0
],
[
1,
0,
0.0326,
0.0047,
0,
0.66,... | [
"'''\nCreated on July 31, 2011\n\n@author: ppa\n'''",
"import urllib2",
"from BeautifulSoup import BeautifulSoup",
"import traceback",
"from ultrafinance.lib.util import convertGoogCSVDate",
"from ultrafinance.model import Quote, Tick",
"from ultrafinance.lib.errors import UfException, Errors",
"impor... |
'''
Created on Nov 9, 2011
@author: ppa
'''
from ultrafinance.dam.baseDAM import BaseDAM
from ultrafinance.model import Quote, Tick
import sys
from sqlalchemy import Column, Integer, String, Float, Sequence, create_engine, and_
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import ... | [
[
8,
0,
0.0144,
0.024,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0288,
0.0048,
0,
0.66,
0.0769,
742,
0,
1,
0,
0,
742,
0,
0
],
[
1,
0,
0.0337,
0.0048,
0,
0.66,... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"from ultrafinance.dam.baseDAM import BaseDAM",
"from ultrafinance.model import Quote, Tick",
"import sys",
"from sqlalchemy import Column, Integer, String, Float, Sequence, create_engine, and_",
"from sqlalchemy.orm import sessionmaker",
"from sqlalch... |
''' data access module ''' | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"''' data access module '''"
] |
'''
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... | [
[
8,
0,
0.1154,
0.1923,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2308,
0.0385,
0,
0.66,
0.2,
742,
0,
1,
0,
0,
742,
0,
0
],
[
1,
0,
0.2692,
0.0385,
0,
0.66,
... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"from ultrafinance.dam.baseDAM import BaseDAM",
"from ultrafinance.dam.yahooFinance import YahooFinance",
"import logging",
"LOG = logging.getLogger()",
"class YahooDAM(BaseDAM):\n ''' Yahoo DAM '''\n\n def __init__(self):\n ''' constructor ... |
'''
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 '''
... | [
[
8,
0,
0.033,
0.0549,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0659,
0.011,
0,
0.66,
0.1667,
742,
0,
1,
0,
0,
742,
0,
0
],
[
1,
0,
0.0769,
0.011,
0,
0.66,
... | [
"'''\nCreated on Nov 9, 2011\n\n@author: ppa\n'''",
"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):\n ... |
'''
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... | [
[
8,
0,
0.1452,
0.2581,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6452,
0.7419,
0,
0.66,
1,
546,
0,
4,
0,
0,
0,
0,
3
],
[
8,
1,
0.3226,
0.0323,
1,
0.97,
0... | [
"'''\nCreated on July 31, 2011\n\n@author: ppa\n\ncopyied from http://code.activestate.com/recipes/131499-observer-pattern/\nNot sure whether it's a good idea to remove observer class\n'''",
"class Observable:\n ''' class for observer design pattern '''\n def __init__(self):\n ''' constructor '''\n ... |
''' design patterns ''' | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"''' design patterns '''"
] |
'''
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)... | [
[
8,
0,
0.1154,
0.1923,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2308,
0.0385,
0,
0.66,
0.3333,
715,
0,
1,
0,
0,
715,
0,
0
],
[
14,
0,
0.2692,
0.0385,
0,
0.6... | [
"'''\nCreated on May 26, 2012\n\n@author: ppa\n'''",
"import logging",
"LOG = logging.getLogger()",
"class History(object):\n ''' helper class providing history info '''\n INDEX = \"I\"\n\n def __init__(self):\n ''' constructor '''\n self.timeSymbolTick = {}",
" ''' helper class pr... |
'''
Created on Apr 29, 2012
@author: ppa
'''
import abc
from ultrafinance.pyTaLib.indicator import stddev, sharpeRatio
class BaseMetric(object):
''' base metric class '''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def calculate(self, timePositions):
''' keep record of the account '''
... | [
[
8,
0,
0.0417,
0.0694,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0139,
0,
0.66,
0.2,
38,
0,
1,
0,
0,
38,
0,
0
],
[
1,
0,
0.0972,
0.0139,
0,
0.66,
... | [
"'''\nCreated on Apr 29, 2012\n\n@author: ppa\n'''",
"import abc",
"from ultrafinance.pyTaLib.indicator import stddev, sharpeRatio",
"class BaseMetric(object):\n ''' base metric class '''\n __metaclass__ = abc.ABCMeta\n\n @abc.abstractmethod\n def calculate(self, timePositions):\n ''' keep ... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.backTest.constant import EVENT_TICK_UPDATE
from threading import Thread
from time import sleep
import logging
LOG = logging.getLogger()
class TradingEngine(object):
''' constructor
no tick operation should take more that 0.5 second
th... | [
[
8,
0,
0.0191,
0.0318,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0382,
0.0064,
0,
0.66,
0.1667,
801,
0,
1,
0,
0,
801,
0,
0
],
[
1,
0,
0.051,
0.0064,
0,
0.66,... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"from ultrafinance.backTest.constant import EVENT_TICK_UPDATE",
"from threading import Thread",
"from time import sleep",
"import logging",
"LOG = logging.getLogger()",
"class TradingEngine(object):\n ''' constructor\n no tick operation shoul... |
'''
Created on Nov 6, 2011
@author: ppa
'''
from ultrafinance.model import Side
from ultrafinance.lib.errors import Errors, UfException
import uuid
import logging
LOG = logging.getLogger()
class Account(object):
''' account '''
def __init__(self, cash, commision):
''' constructor '''
self.__... | [
[
8,
0,
0.0186,
0.0311,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0373,
0.0062,
0,
0.66,
0.1667,
18,
0,
1,
0,
0,
18,
0,
0
],
[
1,
0,
0.0435,
0.0062,
0,
0.66,
... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"from ultrafinance.model import Side",
"from ultrafinance.lib.errors import Errors, UfException",
"import uuid",
"import logging",
"LOG = logging.getLogger()",
"class Account(object):\n ''' account '''\n\n def __init__(self, cash, commision):\n ... |
'''
Created on Dec 18, 2011
@author: ppa
'''
from ultrafinance.model import Side, Order
from ultrafinance.lib.errors import Errors, UfException
import uuid
import re
import time
import logging
LOG = logging.getLogger()
class TradingCenter(object):
'''
trading center
Note: set metricNames before adding ac... | [
[
8,
0,
0.0194,
0.0323,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0387,
0.0065,
0,
0.66,
0.125,
18,
0,
2,
0,
0,
18,
0,
0
],
[
1,
0,
0.0452,
0.0065,
0,
0.66,
... | [
"'''\nCreated on Dec 18, 2011\n\n@author: ppa\n'''",
"from ultrafinance.model import Side, Order",
"from ultrafinance.lib.errors import Errors, UfException",
"import uuid",
"import re",
"import time",
"import logging",
"LOG = logging.getLogger()",
"class TradingCenter(object):\n '''\n trading ... |
'''
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.... | [
[
8,
0,
0.1071,
0.1786,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2143,
0.0357,
0,
0.66,
0.2,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.2857,
0.0357,
0,
0.66,
... | [
"'''\nCreated on Jan 6, 2012\n\n@author: ppa\n'''",
"import re",
"OUTPUT_PREFIX = 'output'",
"OUTPUT_FIELDS = ['placedOrder', 'accountValue', 'executedOrder']",
"def findInListbyRe(itemList, reString):\n ''' find items in list by re '''\n items = []\n pair = re.compile(reString)\n\n for item in ... |
'''
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
import time
import logging
LOG = logging.getLogger()
class TickFee... | [
[
8,
0,
0.0213,
0.0355,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0426,
0.0071,
0,
0.66,
0.125,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.0496,
0.0071,
0,
0.66,
... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"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",
"import time",
"import logging",
... |
'''
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... | [
[
8,
0,
0.0968,
0.1613,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1935,
0.0323,
0,
0.66,
0.2,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.2258,
0.0323,
0,
0.66,
... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"from ultrafinance.lib.errors import Errors, UfException",
"from ultrafinance.designPattern.singleton import Singleton",
"import logging",
"LOG = logging.getLogger()",
"class StateSaverFactory(Singleton):\n ''' factory for output saver '''\n @stati... |
'''
Created on Mar 1, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.backTest.stateSaver import StateSaver
from sqlalchemy import Table, Column, Integer, String, create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
import logging
LOG = loggi... | [
[
8,
0,
0.0259,
0.0431,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0517,
0.0086,
0,
0.66,
0.1111,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.0603,
0.0086,
0,
0.66,
... | [
"'''\nCreated on Mar 1, 2011\n\n@author: ppa\n'''",
"from ultrafinance.lib.errors import Errors, UfException",
"from ultrafinance.backTest.stateSaver import StateSaver",
"from sqlalchemy import Table, Column, Integer, String, create_engine, MetaData",
"from sqlalchemy.ext.declarative import declarative_base... |
'''
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... | [
[
8,
0,
0.0385,
0.0641,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0769,
0.0128,
0,
0.66,
0.125,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.0897,
0.0128,
0,
0.66,
... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"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 = loggi... |
'''
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... | [
[
8,
0,
0.06,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.2,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.14,
0.02,
0,
0.66,
0.4,
38,... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"from ultrafinance.lib.errors import Errors, UfException",
"import abc",
"import logging",
"LOG = logging.getLogger()",
"class StateSaver(object):\n ''' state saver '''\n __metaclass__ = abc.ABCMeta\n\n def __init__(self):\n ''' construct... |
'''
Created on Jan 29, 2011
@author: ppa
'''
from ultrafinance.lib.errors import Errors, UfException
from ultrafinance.backTest.account import Account
import logging
LOG = logging.getLogger()
class AccountManager(object):
'''
account manager
Note: set metricNames before creating accounts
'''
def ... | [
[
8,
0,
0.0556,
0.0926,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1111,
0.0185,
0,
0.66,
0.2,
55,
0,
2,
0,
0,
55,
0,
0
],
[
1,
0,
0.1296,
0.0185,
0,
0.66,
... | [
"'''\nCreated on Jan 29, 2011\n\n@author: ppa\n'''",
"from ultrafinance.lib.errors import Errors, UfException",
"from ultrafinance.backTest.account import Account",
"import logging",
"LOG = logging.getLogger()",
"class AccountManager(object):\n '''\n account manager\n Note: set metricNames before... |
'''
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()
| [
[
8,
0,
0.2,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4667,
0.0667,
0,
0.66,
0.3333,
78,
0,
1,
0,
0,
78,
0,
0
],
[
3,
0,
0.7,
0.2667,
0,
0.66,
0.... | [
"'''\nCreated on Jan 24, 2012\n\n@author: ppa\n'''",
"from ultrafinance.designPattern.singleton import Singleton",
"class AppGlobal(dict, Singleton):\n ''' appGlobal class '''\n def __init__(self):\n super(AppGlobal, self).__init__()",
" ''' appGlobal class '''",
" def __init__(self):\n ... |
""" backtest package """
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\" backtest package \"\"\""
] |
'''
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
... | [
[
8,
0,
0.0566,
0.0943,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1132,
0.0189,
0,
0.66,
0.25,
38,
0,
1,
0,
0,
38,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66,
... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"import abc",
"import uuid",
"import threading",
"class TickSubsriber(object):\n ''' tick subscriber '''\n __metaclass__ = abc.ABCMeta\n\n def __init__(self, name):\n ''' constructor '''\n self.__id = self.__generateId()\n sel... |
'''
Created on Dec 26, 2011
@author: ppa
'''
from ultrafinance.backTest.tickSubscriber.strategies.periodStrategy import PeriodStrategy
from ultrafinance.lib.errors import Errors, UfException
class StrategyFactory(object):
''' Strategy factory '''
STRATEGY_DICT = {'period': PeriodStrategy}
@staticmethod... | [
[
8,
0,
0.1154,
0.1923,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2692,
0.0385,
0,
0.66,
0.3333,
71,
0,
1,
0,
0,
71,
0,
0
],
[
1,
0,
0.3462,
0.0385,
0,
0.66,
... | [
"'''\nCreated on Dec 26, 2011\n\n@author: ppa\n'''",
"from ultrafinance.backTest.tickSubscriber.strategies.periodStrategy import PeriodStrategy",
"from ultrafinance.lib.errors import Errors, UfException",
"class StrategyFactory(object):\n ''' Strategy factory '''\n STRATEGY_DICT = {'period': PeriodStrat... |
'''
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
import logging
LOG = logging.getLogger()
class BaseStrategy(TickSubsriber):
'... | [
[
8,
0,
0.0492,
0.082,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0984,
0.0164,
0,
0.66,
0.1429,
38,
0,
1,
0,
0,
38,
0,
0
],
[
1,
0,
0.1148,
0.0164,
0,
0.66,
... | [
"'''\nCreated on Dec 25, 2011\n\n@author: ppa\n'''",
"import abc",
"from ultrafinance.backTest.tickSubscriber import TickSubsriber",
"from ultrafinance.lib.errors import Errors, UfException",
"from ultrafinance.backTest.constant import EVENT_TICK_UPDATE",
"import logging",
"LOG = logging.getLogger()",
... |
''' strategy ''' | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"''' strategy '''"
] |
'''
Created on Dec 25, 2011
@author: ppa
'''
from ultrafinance.model import Side, Order
from ultrafinance.backTest.tickSubscriber.strategies.baseStrategy import BaseStrategy
from ultrafinance.backTest.constant import CONF_PERIOD
import logging
LOG = logging.getLogger()
class PeriodStrategy(BaseStrategy):
''' per... | [
[
8,
0,
0.06,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.1667,
18,
0,
2,
0,
0,
18,
0,
0
],
[
1,
0,
0.14,
0.02,
0,
0.66,
0.3333,
... | [
"'''\nCreated on Dec 25, 2011\n\n@author: ppa\n'''",
"from ultrafinance.model import Side, Order",
"from ultrafinance.backTest.tickSubscriber.strategies.baseStrategy import BaseStrategy",
"from ultrafinance.backTest.constant import CONF_PERIOD",
"import logging",
"LOG = logging.getLogger()",
"class Peri... |
'''
Created on Jan 20, 2012
@author: ppa
'''
#config constant
CONF_SYMBOLRE = 'symbolre'
CONF_PERIOD = 'period'
CONF_STRATEGY = 'strategy'
CONF_STRATEGY_NAME = 'name'
CONF_APP_MAIN = 'app_main'
CONF_TRADE_TYPE = 'tradetype'
CONF_SYMBOL_FILE = 'symbolfile'
CONF_INDEX = 'index'
# input
CONF_INPUT_SECTION = 'input'
C... | [
[
8,
0,
0.0882,
0.1471,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2353,
0.0294,
0,
0.66,
0.0588,
644,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2647,
0.0294,
0,
0.66... | [
"'''\nCreated on Jan 20, 2012\n\n@author: ppa\n'''",
"CONF_SYMBOLRE = 'symbolre'",
"CONF_PERIOD = 'period'",
"CONF_STRATEGY = 'strategy'",
"CONF_STRATEGY_NAME = 'name'",
"CONF_APP_MAIN = 'app_main'",
"CONF_TRADE_TYPE = 'tradetype'",
"CONF_SYMBOL_FILE = 'symbolfile'",
"CONF_INDEX = 'index'",
"CONF_... |
'''
Created on May 26, 2012
@author: ppa
'''
import logging
LOG = logging.getLogger()
class IndexHelper(object):
''' helper class providing index info '''
MAX_SIZE = 252
def __init__(self):
''' constructor '''
self.__tick = []
def appendTick(self, tick):
''' self current tick... | [
[
8,
0,
0.1364,
0.2273,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2727,
0.0455,
0,
0.66,
0.3333,
715,
0,
1,
0,
0,
715,
0,
0
],
[
14,
0,
0.3182,
0.0455,
0,
0.6... | [
"'''\nCreated on May 26, 2012\n\n@author: ppa\n'''",
"import logging",
"LOG = logging.getLogger()",
"class IndexHelper(object):\n ''' helper class providing index info '''\n MAX_SIZE = 252\n\n def __init__(self):\n ''' constructor '''\n self.__tick = []",
" ''' helper class providi... |
'''
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 '''... | [
[
8,
0,
0.0441,
0.0735,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0882,
0.0147,
0,
0.66,
0.1429,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.1029,
0.0147,
0,
0.66... | [
"'''\nCreated on Nov 30, 2010\n\n@author: ppa\n'''",
"import ConfigParser",
"from os import path",
"from ultrafinance.lib.errors import UfException, Errors",
"import logging",
"LOG = logging.getLogger()",
"class PyConfig(object):\n ''' class that handles configuration '''\n def __init__(self):\n ... |
''' config module ''' | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"''' config module '''"
] |
'''
Created on May 26, 2012
@author: ppa
'''
import numpy
from math import sqrt
from collections import deque
def mean(array):
''' average '''
return numpy.mean(array, axis = 0)
def stddev(array):
''' Standard Deviation '''
return numpy.std(array, axis = 0)
def sharpeRatio(array, n ... | [
[
8,
0,
0.0682,
0.1136,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1364,
0.0227,
0,
0.66,
0.125,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.1591,
0.0227,
0,
0.66,... | [
"'''\nCreated on May 26, 2012\n\n@author: ppa\n'''",
"import numpy",
"from math import sqrt",
"from collections import deque",
"def mean(array):\n ''' average '''\n return numpy.mean(array, axis = 0)",
" ''' average '''",
" return numpy.mean(array, axis = 0)",
"def stddev(array):\n ''' ... |
""" talib python impl""" | [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\" talib python impl\"\"\""
] |
'''
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... | [
[
8,
0,
0.0083,
0.0139,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0167,
0.0028,
0,
0.66,
0.0312,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0194,
0.0028,
0,
0.66... | [
"'''\nCreated on April 15, 2012\n\n@author: Bruno Franca\n'''",
"import numpy",
"from pandas import *",
"from math import *",
"def MA(df, n):\n MA = Series(rolling_mean(df['Close'], n), name = 'MA_' + str(n))\n df = df.join(MA)\n return df",
" MA = Series(rolling_mean(df['Close'], n), name = '... |
""" 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".*\.(zip... | [
[
8,
0,
0.0769,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.2,
688,
0,
3,
0,
0,
688,
0,
0
],
[
1,
0,
0.3077,
0.0769,
0,
0.66,
... | [
"\"\"\" ultrafinance package \"\"\"",
"import os, re, sys",
"import logging",
"LOG = logging.getLogger()",
"LIB = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'lib')",
"for entry in os.listdir(LIB):\n filePath = os.path.join(LIB, entry)\n if os.path.isfile(filePath) and ... |
'''
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 importClass(path, moduleName, className = None):
''' dynamically import class '''
... | [
[
8,
0,
0.0385,
0.0641,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0769,
0.0128,
0,
0.66,
0.0625,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0897,
0.0128,
0,
0.66... | [
"'''\nCreated on Dec 18, 2010\n\n@author: ppa\n'''",
"import sys",
"from BeautifulSoup import BeautifulSoup",
"from datetime import datetime",
"import time",
"import logging",
"LOG = logging.getLogger()",
"googCSVDateformat = \"%d-%b-%y\"",
"def importClass(path, moduleName, className = None):\n ... |
'''
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... | [
[
8,
0,
0.0345,
0.0575,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.069,
0.0115,
0,
0.66,
0.3333,
423,
0,
1,
0,
0,
423,
0,
0
],
[
3,
0,
0.431,
0.6897,
0,
0.66,
... | [
"'''\nCreated on May 6, 2011\n\n@author: ppa\n'''",
"import traceback",
"class Errors(object):\n \"\"\" class hosts error code constants \"\"\"\n # general errors\n UNKNOWN_ERROR = 1\n FILE_NOT_EXIST = 2\n FILE_EXIST = 3\n UNDEFINED_METHOD = 4",
" \"\"\" class hosts error code constants \... |
''' 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... | [
[
8,
0,
0.0667,
0.0667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.2667,
0.0667,
0,
0.66,
... | [
"''' ultraFinance lib '''",
"import os, sys",
"import logging",
"LOG = logging.getLogger(__name__)",
"'''\nmainSrc = os.path.join(os.path.dirname( (os.path.dirname(os.path.abspath(__file__)))))\nsys.path.append(mainSrc)\n\nlogging.basicConfig(level=logging.DEBUG,\n format='%(asctime)s.%(m... |
'''
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... | [
[
8,
0,
0.0492,
0.082,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0984,
0.0164,
0,
0.66,
0.1667,
75,
0,
1,
0,
0,
75,
0,
0
],
[
1,
0,
0.1148,
0.0164,
0,
0.66,
... | [
"'''\nCreated on Jan 3, 2011\n\n@author: ppa\n'''",
"from matplotlib import pyplot",
"from datetime import datetime",
"from ultrafinance.lib.errors import UfException, Errors",
"import logging",
"LOG = logging.getLogger()",
"class PlotDateValueDict(object):\n ''' plot dict with date value '''\n de... |
'''
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', ... | [
[
8,
0,
0.0204,
0.034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0408,
0.0068,
0,
0.66,
0.1111,
463,
0,
1,
0,
0,
463,
0,
0
],
[
1,
0,
0.0476,
0.0068,
0,
0.66,... | [
"'''\nCreated on Nov 6, 2011\n\n@author: ppa\n'''",
"import json",
"from collections import namedtuple",
"from ultrafinance.lib.errors import UfException, Errors",
"TICK_FIELDS = ['time', 'open', 'high', 'low', 'close', 'volume']",
"QUOTE_FIELDS = ['time', 'open', 'high', 'low', 'close', 'volume', 'adjClo... |
'''
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... | [
[
8,
0,
0.0603,
0.1034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1207,
0.0172,
0,
0.66,
0.1429,
152,
0,
1,
0,
0,
152,
0,
0
],
[
1,
0,
0.1379,
0.0172,
0,
0.66... | [
"'''\nCreated on July 4, 2011\n\n@author: ppa\ncopied from http://da44en.wordpress.com/2002/11/22/using-distutils/\n'''",
"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",
... |
'''
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... | [
[
8,
0,
0.0153,
0.0255,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0357,
0.0051,
0,
0.66,
0.0435,
365,
0,
1,
0,
0,
365,
0,
0
],
[
1,
0,
0.0408,
0.0051,
0,
0.66... | [
"'''\nCreated on Dec 3, 2011\n\n@author: ppa\n'''",
"from ultrafinance.backTest.tickSubscriber.strategies.strategyFactory import StrategyFactory",
"from ultrafinance.backTest.tradingCenter import TradingCenter",
"from ultrafinance.backTest.tickFeeder import TickFeeder",
"from ultrafinance.backTest.tradingEn... |
'''
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... | [
[
8,
0,
0.0306,
0.051,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0612,
0.0102,
0,
0.66,
0.2,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0714,
0.0102,
0,
0.66,
... | [
"'''\nCreated on Aug 11, 2011\n\n@author: ppa\n'''",
"import os",
"import sys",
"from ultrafinance.lib.googleFinance import GoogleFinance",
"class StockPicker:\n ''' sort stocks '''\n def __init__(self):\n ''' constructor '''\n self.__workingDir = os.path.join(os.path.dirname(os.path.dir... |
'''
Created on Dec 4, 2011
@author: ppa
'''
from ultrafinance.dam.DAMFactory import DAMFactory
from os import path
import datetime
from dateutil.relativedelta import relativedelta
import optparse
from threading import Thread
from threading import Lock
BATCH_SIZE = 30
THREAD_TIMEOUT = 5
MAX_TRY = 3
class SymbolCraw... | [
[
8,
0,
0.0156,
0.026,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0312,
0.0052,
0,
0.66,
0.0833,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0417,
0.0052,
0,
0.66,... | [
"'''\nCreated on Dec 4, 2011\n\n@author: ppa\n'''",
"from ultrafinance.dam.DAMFactory import DAMFactory",
"from os import path",
"import datetime",
"from dateutil.relativedelta import relativedelta",
"import optparse",
"from threading import Thread",
"from threading import Lock",
"BATCH_SIZE = 30",
... |
""" application package """
import os, sys
mainSrc = os.path.dirname(os.path.abspath(__file__))
sys.path.append(mainSrc)
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.3333,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"\"\"\" application package \"\"\"",
"import os, sys",
"mainSrc = os.path.dirname(os.path.abspath(__file__))",
"sys.path.append(mainSrc)"
] |
'''
Created on Dec 4, 2011
@author: ppa
'''
from ultrafinance.dam.DAMFactory import DAMFactory
from os import path
import optparse
from threading import Thread
from threading import Lock
BATCH_SIZE = 30
THREAD_TIMEOUT = 5
MAX_TRY = 3
class FundamentalCrawler(object):
''' collect fundamental for a list of symbol... | [
[
8,
0,
0.0208,
0.0347,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0417,
0.0069,
0,
0.66,
0.1,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0486,
0.0069,
0,
0.66,
... | [
"'''\nCreated on Dec 4, 2011\n\n@author: ppa\n'''",
"from ultrafinance.dam.DAMFactory import DAMFactory",
"from os import path",
"import optparse",
"from threading import Thread",
"from threading import Lock",
"BATCH_SIZE = 30",
"THREAD_TIMEOUT = 5",
"MAX_TRY = 3",
"class FundamentalCrawler(object... |
'''Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
[
8,
0,
0.0547,
0.1016,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1094,
0.0078,
0,
0.66,
0.0625,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.125,
0.0078,
0,
0.66,... | [
"'''Copyright 2011 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0",
"from google.appengine.api import ... |
'''Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
[
8,
0,
0.25,
0.4643,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5357,
0.0357,
0,
0.66,
0.25,
463,
0,
1,
0,
0,
463,
0,
0
],
[
1,
0,
0.5714,
0.0357,
0,
0.66,
... | [
"'''Copyright 2011 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0",
"import json",
"import logging",... |
'''Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
[
8,
0,
0.1489,
0.2766,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3404,
0.0213,
0,
0.66,
0.0667,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.3617,
0.0213,
0,
0.66... | [
"'''Copyright 2011 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0",
"from google.appengine.api import ... |
'''Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
[
8,
0,
0.0282,
0.0524,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0605,
0.004,
0,
0.66,
0.0909,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0645,
0.004,
0,
0.66,
... | [
"'''Copyright 2011 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0",
"from google.appengine.api import ... |
'''Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
[
8,
0,
0.5385,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"'''Copyright 2011 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0"
] |
import logging
# Change default log level to debug in dev_appserver to match production
logging.getLogger().setLevel(logging.DEBUG)
# but leave the default for App Engine APIs
logging.getLogger('google.appengine').setLevel(logging.INFO)
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
8,
0,
0.5714,
0.1429,
0,
0.66,
0.5,
810,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.1429,
0,
0.66,
... | [
"import logging",
"logging.getLogger().setLevel(logging.DEBUG)",
"logging.getLogger('google.appengine').setLevel(logging.INFO)"
] |
import io
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'), ('Content-length',
str(int(len(string.ascii_lowercase)/2)))]
start_response(status, response_headers)
filelike = io.StringIO(string.ascii_low... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
518,
0,
1,
0,
0,
518,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6538,
0.7692,
0,
0.6... | [
"import io",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain'), ('Content-length',\n str(int(len(string.ascii_lowercase)/2)))]\n start_response(status, response_headers)\n\n filelike = io.Stri... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w')
filelike.write(string.ascii_lowercase)
filelike.close()
filelike = op... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.625,
0.8125,
0,
0.66,... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n\n filelike = open('/tmp/filetest.txt', 'w')\n filelike.write(string.ascii_lowercase)",
" status = ... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike1 = open('/tmp/filetest-a.txt', 'w+')
filelike1.write(string.ascii_lowercase)
filelike1.flush()
... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.56,
0.84,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike1 = open('/tmp/filetest-a.txt', 'w+')\n filelike1.write(string.ascii_lowercase)",
... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'), ('Content-length',
str(int(len(string.ascii_lowercase)/2)))]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6176,
0.8235,
0,
0.6... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain'), ('Content-length',\n str(int(len(string.ascii_lowercase)/2)))]\n start_response(status, response_headers)\n\n filelike = open('/... |
import io
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = io.StringIO(string.ascii_lowercase)
return environ['wsgi.file_wrapper'](filelike)
| [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
518,
0,
1,
0,
0,
518,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6667,
0.75,
0,
0.66,... | [
"import io",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n\n filelike = io.StringIO(string.ascii_lowercase)",
" status = '200 OK'",
" response_headers = [(... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w+')
filelike.write(string.ascii_lowercase)
filelike.flush()
... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.625,
0.8125,
0,
0.66,... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK' \n \n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n \n filelike = open('/tmp/filetest.txt', 'w+')\n filelike.write(string.ascii_lowercase)",
" ... |
import io
import os
def application(environ, start_response):
headers = []
headers.append(('Content-Type', 'text/plain'))
write = start_response('200 OK', headers)
input = environ['wsgi.input']
output = io.StringIO()
print("PID: %s" % os.getpid(), file=output)
print("UID: %s" % os.getuid(... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
518,
0,
1,
0,
0,
518,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.5,
688,
0,
1,
0,
0,
688,
0,
0
],
[
2,
0,
0.58,
0.88,
0,
0.66,
1,
... | [
"import io",
"import os",
"def application(environ, start_response):\n headers = []\n headers.append(('Content-Type', 'text/plain'))\n write = start_response('200 OK', headers)\n\n input = environ['wsgi.input']\n output = io.StringIO()",
" headers = []",
" headers.append(('Content-Type'... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike1 = open('/tmp/filetest-a.txt', 'w+')
filelike1.write(string.ascii_lowercase)
filelike1.flush()
... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.56,
0.84,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike1 = open('/tmp/filetest-a.txt', 'w+')\n filelike1.write(string.ascii_lowercase)",
... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'), ('Content-length',
str(int(len(string.ascii_lowercase)/4)))]
start_response(status, response_headers)
filelike = open('/tmp/filetest... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6176,
0.8235,
0,
0.6... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK' \n \n response_headers = [('Content-type', 'text/plain'), ('Content-length',\n str(int(len(string.ascii_lowercase)/4)))]\n start_response(status, response_headers)\n \n filelike ... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w+')
filelike.write(string.ascii_lowercase)
filelike.flush()
file... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.575,
0.8,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike = open('/tmp/filetest.txt', 'w+')\n filelike.write(string.ascii_lowercase)",
" ... |
def application(environ, start_response):
status = '200 OK'
output = b'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
| [
[
2,
0,
0.5556,
1,
0,
0.66,
0,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.2222,
0.1111,
1,
0.59,
0,
699,
1,
0,
0,
0,
0,
3,
0
],
[
14,
1,
0.3333,
0.1111,
1,
0.59,
0.... | [
"def application(environ, start_response):\n status = '200 OK' \n output = b'Hello World!'\n\n response_headers = [('Content-type', 'text/plain'),\n ('Content-Length', str(len(output)))]\n start_response(status, response_headers)",
" status = '200 OK'",
" output = b'Hell... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike = open('/tmp/filetest-a.txt', 'w+')
filelike.write(string.ascii_lowercase)
filelike.flush()
fi... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6053,
0.8421,
0,
0.6... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike = open('/tmp/filetest-a.txt', 'w+')\n filelike.write(string.ascii_lowercase)",
" ... |
import StringIO
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),
('Content-length', str(len(string.ascii_lowercase)/2))]
start_response(status, response_headers)
filelike = StringIO.StringIO(string.as... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6538,
0.7692,
0,
0.6... | [
"import StringIO",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain'),\n ('Content-length', str(len(string.ascii_lowercase)/2))]\n start_response(status, response_headers)\n\n filelike = String... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w')
filelike.write(string.ascii_lowercase)
filelike.close()
filelike = op... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.625,
0.8125,
0,
0.66,... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n\n filelike = open('/tmp/filetest.txt', 'w')\n filelike.write(string.ascii_lowercase)",
" status = ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/content_length-1b.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
200
>>> response.getheader('Content-Length')
'24'
>>> response.read... | [
[
8,
0,
0.2969,
0.5625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8125,
0.4062,
0,
0.66,
1,
244,
0,
2,
0,
0,
0,
0,
4
],
[
14,
1,
0.6562,
0.0312,
1,
0.03,
... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/content_length-1b.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike1 = open('/tmp/filetest-a.txt', 'w+')
filelike1.write(string.ascii_lowercase)
filelike1.flush()
... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.56,
0.84,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike1 = open('/tmp/filetest-a.txt', 'w+')\n filelike1.write(string.ascii_lowercase)",
... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),
('Content-length', str(len(string.ascii_lowercase)/2))]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w+')
... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6176,
0.8235,
0,
0.6... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain'),\n ('Content-length', str(len(string.ascii_lowercase)/2))]\n start_response(status, response_headers)\n\n filelike = open('/tmp/f... |
import StringIO
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = StringIO.StringIO(string.ascii_lowercase)
return environ['wsgi.file_wrapper'](filelike)
| [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6667,
0.75,
0,
0.66,... | [
"import StringIO",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n\n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n\n filelike = StringIO.StringIO(string.ascii_lowercase)",
" status = '200 OK'",
" response_... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w+')
filelike.write(string.ascii_lowercase)
filelike.flush()
... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.625,
0.8125,
0,
0.66,... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK' \n \n response_headers = [('Content-type', 'text/plain')]\n start_response(status, response_headers)\n \n filelike = open('/tmp/filetest.txt', 'w+')\n filelike.write(string.ascii_lowercase)",
" ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1g.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-5] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.3333,
0.6296,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8519,
0.3333,
0,
0.66,
1,
244,
0,
2,
0,
0,
0,
0,
4
],
[
14,
1,
0.7407,
0.037,
1,
0.95,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1g.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1c.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-2] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.3333,
0.6296,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8519,
0.3333,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7407,
0.037,
1,
0.12,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1c.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/content_length-1c.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
200
>>> response.getheader('Content-Length')
'24'
>>> response.read... | [
[
8,
0,
0.3393,
0.6429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8571,
0.3214,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.75,
0.0357,
1,
0.64,
0,... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/content_length-1c.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> connection.putrequest('GET', '/dump_environ.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
200
"""
import cStringIO
import os
def application(environ, start_response):
headers = []
headers.... | [
[
8,
0,
0.1667,
0.3056,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3611,
0.0278,
0,
0.66,
0.3333,
764,
0,
1,
0,
0,
764,
0,
0
],
[
1,
0,
0.3889,
0.0278,
0,
0.66... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> connection.putrequest('GET', '/dump_environ.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()\n>>> response.status",
"import cStringIO",
"import os",
"def application(environ, start_response):\n heade... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/start_response-1b.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-1]
'[error] ValueError: status code is not a 3 di... | [
[
8,
0,
0.3125,
0.5833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8333,
0.375,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7083,
0.0417,
1,
0.1,
0,... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/start_response-1b.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '20 OK' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/start_response-1a.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-1]
'[error] ValueError: status code is not a 3 di... | [
[
8,
0,
0.3125,
0.5833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8333,
0.375,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7083,
0.0417,
1,
0.49,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/start_response-1a.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '' \n ou... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/content_length-1a.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
200
>>> response.getheader('Content-Length')
'12'
>>> response.read... | [
[
8,
0,
0.3393,
0.6429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8571,
0.3214,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.75,
0.0357,
1,
0.05,
0,... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/content_length-1a.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/start_response-1d.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-1]
'[error] ValueError: no space following status... | [
[
8,
0,
0.3125,
0.5833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8333,
0.375,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7083,
0.0417,
1,
0.93,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/start_response-1d.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1d.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-2] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.3103,
0.5862,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8276,
0.3793,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.6897,
0.0345,
1,
0.46,
... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1d.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1b.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-2] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.36,
0.68,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.88,
0.28,
0,
0.66,
1,
244,
0,
2,
0,
0,
0,
0,
3
],
[
14,
1,
0.8,
0.04,
1,
0.55,
0,
699,
... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1b.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = '200 OK' \n ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1a.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-5] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.45,
0.85,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.975,
0.1,
0,
0.66,
1,
244,
0,
2,
0,
0,
0,
0,
1
]
] | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1a.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n raise RuntimeError(\"ERR... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike1 = open('/tmp/filetest-a.txt', 'w+')
filelike1.write(string.ascii_lowercase)
filelike1.flush()
... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.56,
0.84,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike1 = open('/tmp/filetest-a.txt', 'w+')\n filelike1.write(string.ascii_lowercase)",
... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),
('Content-length', str(len(string.ascii_lowercase)/4))]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt'... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.6176,
0.8235,
0,
0.6... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK' \n \n response_headers = [('Content-type', 'text/plain'),\n ('Content-length', str(len(string.ascii_lowercase)/4))]\n start_response(status, response_headers)\n \n filelike = ope... |
import os
import string
def application(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),]
start_response(status, response_headers)
filelike = open('/tmp/filetest.txt', 'w+')
filelike.write(string.ascii_lowercase)
filelike.flush()
file... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
2,
0,
0.575,
0.8,
0,
0.66,
1,
... | [
"import os",
"import string",
"def application(environ, start_response):\n status = '200 OK'\n \n response_headers = [('Content-type', 'text/plain'),]\n start_response(status, response_headers)\n \n filelike = open('/tmp/filetest.txt', 'w+')\n filelike.write(string.ascii_lowercase)",
" ... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/exceptions-1h.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-2] # doctest: +ELLIPSIS
"[error] ... Exception occurr... | [
[
8,
0,
0.2727,
0.5152,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6364,
0.1515,
0,
0.66,
0.5,
621,
0,
2,
0,
0,
0,
0,
0
],
[
2,
1,
0.6212,
0.0606,
1,
0.14,
... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/exceptions-1h.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"class Iterable:\n def __init__(self, output):\n self.__output... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/start_response-1h.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-1]
'[error] TypeError: expected byte string objec... | [
[
8,
0,
0.3125,
0.5833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8333,
0.375,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7083,
0.0417,
1,
0.73,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/start_response-1h.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = None\n o... |
"""
>>> import _testfuncs
>>> connection = _testfuncs.connection()
>>> messages = _testfuncs.messages()
>>> connection.putrequest('GET', '/start_response-1g.wsgi')
>>> connection.endheaders()
>>> response = connection.getresponse()
>>> response.status
500
>>> messages[-1]
'[error] ValueError: status code is not a 3 di... | [
[
8,
0,
0.3125,
0.5833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8333,
0.375,
0,
0.66,
1,
244,
0,
2,
1,
0,
0,
0,
3
],
[
14,
1,
0.7083,
0.0417,
1,
0.99,
0... | [
"\"\"\"\n\n>>> import _testfuncs\n>>> connection = _testfuncs.connection()\n>>> messages = _testfuncs.messages()\n>>> connection.putrequest('GET', '/start_response-1g.wsgi')\n>>> connection.endheaders()\n>>> response = connection.getresponse()",
"def application(environ, start_response):\n status = 'XYZ OK' \n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.