MCPcopy Create free account
hub / github.com/QuantFans/quantdigger / Record

Class Record

quantdigger/kernel/datasource/data.py:54–76  ·  view source on GitHub ↗

Represents a record.

Source from the content-addressed store, hash-verified

52
53
54class Record(object):
55 """Represents a record."""
56 def __init__(self):
57 self.entry_datetime = ""
58 self.entry_bar= None
59 self.exit_bar = None
60 self.entry_price = None
61 self.exit_profit = None
62 self.period = None
63 self.low_profit = None
64 # high since
65 self.high_profit = None
66 self.entry_nbar = []
67 self.exit_nbar = []
68
69 def is_long(self):
70 '''docstring for is_long()'''
71 # 如果是单根开平,且开平价一样,那么此法不成立
72 return self.high_profit > self.low_profit
73
74 def __str__(self):
75 '''docstring for __s'''
76 return "entry_datetime: %s\nentry_bar: %s\nPeriod: %s\nlow_profit: %s\nhigh_profit: %s\nEntryPrice: %s\nExitPrice: %s\nEntrynbar: %s\nExitnbar: %s\n"%(str(self.entry_datetime),str(self.entry_bar), str(self.period), str(self.low_profit), str(self.high_profit), str(self.entry_price), str(self.exit_profit), str(self.entry_nbar), str(self.exit_nbar))
77
78
79def make_record(data, i):

Callers 1

make_recordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected