repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
text_list_to_colors_simple
def text_list_to_colors_simple(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' uNames = list(set(names)) uNames.sort() textToColor = [ uNames.index(n) for n in names ] textToColor = np.array(textToColor) textTo...
python
def text_list_to_colors_simple(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' uNames = list(set(names)) uNames.sort() textToColor = [ uNames.index(n) for n in names ] textToColor = np.array(textToColor) textTo...
[ "def", "text_list_to_colors_simple", "(", "names", ")", ":", "uNames", "=", "list", "(", "set", "(", "names", ")", ")", "uNames", ".", "sort", "(", ")", "textToColor", "=", "[", "uNames", ".", "index", "(", "n", ")", "for", "n", "in", "names", "]", ...
Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors.
[ "Generates", "a", "list", "of", "colors", "based", "on", "a", "list", "of", "names", "(", "strings", ")", ".", "Similar", "strings", "correspond", "to", "similar", "colors", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L77-L89
train
Generates a list of colors based on a list of strings. Similar strings correspond to similar colors.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
chordialDiagram
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
python
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
[ "def", "chordialDiagram", "(", "fileStr", ",", "SM", ",", "Threshold", ",", "names", ",", "namesCategories", ")", ":", "colors", "=", "text_list_to_colors_simple", "(", "namesCategories", ")", "SM2", "=", "SM", ".", "copy", "(", ")", "SM2", "=", "(", "SM2"...
Generates a d3js chordial diagram that illustrates similarites
[ "Generates", "a", "d3js", "chordial", "diagram", "that", "illustrates", "similarites" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L92-L123
train
Generates a d3js chordial diagram that illustrates similarites
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
visualizeFeaturesFolder
def visualizeFeaturesFolder(folder, dimReductionMethod, priorKnowledge = "none"): ''' This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: ...
python
def visualizeFeaturesFolder(folder, dimReductionMethod, priorKnowledge = "none"): ''' This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: ...
[ "def", "visualizeFeaturesFolder", "(", "folder", ",", "dimReductionMethod", ",", "priorKnowledge", "=", "\"none\"", ")", ":", "if", "dimReductionMethod", "==", "\"pca\"", ":", "allMtFeatures", ",", "wavFilesList", ",", "_", "=", "aF", ".", "dirWavFeatureExtraction",...
This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: method used to reduce the dimension of the initial feature space before computing the similari...
[ "This", "function", "generates", "a", "chordial", "visualization", "for", "the", "recordings", "of", "the", "provided", "path", ".", "ARGUMENTS", ":", "-", "folder", ":", "path", "of", "the", "folder", "that", "contains", "the", "WAV", "files", "to", "be", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L126-L232
train
This function generates a chordial visualization for the recordings of the folder.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stZCR
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
python
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
[ "def", "stZCR", "(", "frame", ")", ":", "count", "=", "len", "(", "frame", ")", "countZ", "=", "numpy", ".", "sum", "(", "numpy", ".", "abs", "(", "numpy", ".", "diff", "(", "numpy", ".", "sign", "(", "frame", ")", ")", ")", ")", "/", "2", "r...
Computes zero crossing rate of frame
[ "Computes", "zero", "crossing", "rate", "of", "frame" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L19-L23
train
Computes zero crossing rate of frame
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stEnergyEntropy
def stEnergyEntropy(frame, n_short_blocks=10): """Computes entropy of energy""" Eol = numpy.sum(frame ** 2) # total frame energy L = len(frame) sub_win_len = int(numpy.floor(L / n_short_blocks)) if L != sub_win_len * n_short_blocks: frame = frame[0:sub_win_len * n_short_blocks] # ...
python
def stEnergyEntropy(frame, n_short_blocks=10): """Computes entropy of energy""" Eol = numpy.sum(frame ** 2) # total frame energy L = len(frame) sub_win_len = int(numpy.floor(L / n_short_blocks)) if L != sub_win_len * n_short_blocks: frame = frame[0:sub_win_len * n_short_blocks] # ...
[ "def", "stEnergyEntropy", "(", "frame", ",", "n_short_blocks", "=", "10", ")", ":", "Eol", "=", "numpy", ".", "sum", "(", "frame", "**", "2", ")", "# total frame energy", "L", "=", "len", "(", "frame", ")", "sub_win_len", "=", "int", "(", "numpy", ".",...
Computes entropy of energy
[ "Computes", "entropy", "of", "energy" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L31-L46
train
Computes the entropy of the energy of a frame.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralCentroidAndSpread
def stSpectralCentroidAndSpread(X, fs): """Computes spectral centroid of frame (given abs(FFT))""" ind = (numpy.arange(1, len(X) + 1)) * (fs/(2.0 * len(X))) Xt = X.copy() Xt = Xt / Xt.max() NUM = numpy.sum(ind * Xt) DEN = numpy.sum(Xt) + eps # Centroid: C = (NUM / DEN) # Spread: ...
python
def stSpectralCentroidAndSpread(X, fs): """Computes spectral centroid of frame (given abs(FFT))""" ind = (numpy.arange(1, len(X) + 1)) * (fs/(2.0 * len(X))) Xt = X.copy() Xt = Xt / Xt.max() NUM = numpy.sum(ind * Xt) DEN = numpy.sum(Xt) + eps # Centroid: C = (NUM / DEN) # Spread: ...
[ "def", "stSpectralCentroidAndSpread", "(", "X", ",", "fs", ")", ":", "ind", "=", "(", "numpy", ".", "arange", "(", "1", ",", "len", "(", "X", ")", "+", "1", ")", ")", "*", "(", "fs", "/", "(", "2.0", "*", "len", "(", "X", ")", ")", ")", "Xt...
Computes spectral centroid of frame (given abs(FFT))
[ "Computes", "spectral", "centroid", "of", "frame", "(", "given", "abs", "(", "FFT", "))" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L52-L71
train
Computes the spectral centroid of frame X given abs ( FFT )
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralEntropy
def stSpectralEntropy(X, n_short_blocks=10): """Computes the spectral entropy""" L = len(X) # number of frame samples Eol = numpy.sum(X ** 2) # total spectral energy sub_win_len = int(numpy.floor(L / n_short_blocks)) # length of sub-frame if L != sub_win_len * n...
python
def stSpectralEntropy(X, n_short_blocks=10): """Computes the spectral entropy""" L = len(X) # number of frame samples Eol = numpy.sum(X ** 2) # total spectral energy sub_win_len = int(numpy.floor(L / n_short_blocks)) # length of sub-frame if L != sub_win_len * n...
[ "def", "stSpectralEntropy", "(", "X", ",", "n_short_blocks", "=", "10", ")", ":", "L", "=", "len", "(", "X", ")", "# number of frame samples", "Eol", "=", "numpy", ".", "sum", "(", "X", "**", "2", ")", "# total spectral energy", "sub_win_len", "=", "int", ...
Computes the spectral entropy
[ "Computes", "the", "spectral", "entropy" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L74-L87
train
Computes the spectral entropy of a single frame.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralFlux
def stSpectralFlux(X, X_prev): """ Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame """ # compute the spectral flux as the sum of square distances: sumX = numpy.sum...
python
def stSpectralFlux(X, X_prev): """ Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame """ # compute the spectral flux as the sum of square distances: sumX = numpy.sum...
[ "def", "stSpectralFlux", "(", "X", ",", "X_prev", ")", ":", "# compute the spectral flux as the sum of square distances:", "sumX", "=", "numpy", ".", "sum", "(", "X", "+", "eps", ")", "sumPrevX", "=", "numpy", ".", "sum", "(", "X_prev", "+", "eps", ")", "F",...
Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame
[ "Computes", "the", "spectral", "flux", "feature", "of", "the", "current", "frame", "ARGUMENTS", ":", "X", ":", "the", "abs", "(", "fft", ")", "of", "the", "current", "frame", "X_prev", ":", "the", "abs", "(", "fft", ")", "of", "the", "previous", "frame...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L90-L102
train
Computes the spectral flux feature of the current frame
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralRollOff
def stSpectralRollOff(X, c, fs): """Computes spectral roll-off""" totalEnergy = numpy.sum(X ** 2) fftLength = len(X) Thres = c*totalEnergy # Ffind the spectral rolloff as the frequency position # where the respective spectral energy is equal to c*totalEnergy CumSum = numpy.cumsum(X ** 2) + ...
python
def stSpectralRollOff(X, c, fs): """Computes spectral roll-off""" totalEnergy = numpy.sum(X ** 2) fftLength = len(X) Thres = c*totalEnergy # Ffind the spectral rolloff as the frequency position # where the respective spectral energy is equal to c*totalEnergy CumSum = numpy.cumsum(X ** 2) + ...
[ "def", "stSpectralRollOff", "(", "X", ",", "c", ",", "fs", ")", ":", "totalEnergy", "=", "numpy", ".", "sum", "(", "X", "**", "2", ")", "fftLength", "=", "len", "(", "X", ")", "Thres", "=", "c", "*", "totalEnergy", "# Ffind the spectral rolloff as the fr...
Computes spectral roll-off
[ "Computes", "spectral", "roll", "-", "off" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L105-L118
train
Computes the spectral roll - off of a frequency set
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stHarmonic
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
python
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
[ "def", "stHarmonic", "(", "frame", ",", "fs", ")", ":", "M", "=", "numpy", ".", "round", "(", "0.016", "*", "fs", ")", "-", "1", "R", "=", "numpy", ".", "correlate", "(", "frame", ",", "frame", ",", "mode", "=", "'full'", ")", "g", "=", "R", ...
Computes harmonic ratio and pitch
[ "Computes", "harmonic", "ratio", "and", "pitch" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L121-L166
train
Computes harmonic ratio and pitch of a single frame.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mfccInitFilterBanks
def mfccInitFilterBanks(fs, nfft): """ Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox """ ...
python
def mfccInitFilterBanks(fs, nfft): """ Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox """ ...
[ "def", "mfccInitFilterBanks", "(", "fs", ",", "nfft", ")", ":", "# filter bank params:", "lowfreq", "=", "133.33", "linsc", "=", "200", "/", "3.", "logsc", "=", "1.0711703", "numLinFiltTotal", "=", "13", "numLogFilt", "=", "27", "if", "fs", "<", "8000", ":...
Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox
[ "Computes", "the", "triangular", "filterbank", "for", "MFCC", "computation", "(", "used", "in", "the", "stFeatureExtraction", "function", "before", "the", "stMFCC", "function", "call", ")", "This", "function", "is", "taken", "from", "the", "scikits", ".", "talkb...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L169-L216
train
This function initializes the filter banks for a single MFCC object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stMFCC
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
python
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
[ "def", "stMFCC", "(", "X", ",", "fbank", ",", "n_mfcc_feats", ")", ":", "mspec", "=", "numpy", ".", "log10", "(", "numpy", ".", "dot", "(", "X", ",", "fbank", ".", "T", ")", "+", "eps", ")", "ceps", "=", "dct", "(", "mspec", ",", "type", "=", ...
Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken from the scikits.talkbox library (MI...
[ "Computes", "the", "MFCCs", "of", "a", "frame", "given", "the", "fft", "mag" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L219-L237
train
Computes the MFCCs of a frame given the fft magnitude X and filter bank.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stChromaFeaturesInit
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
python
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
[ "def", "stChromaFeaturesInit", "(", "nfft", ",", "fs", ")", ":", "freqs", "=", "numpy", ".", "array", "(", "[", "(", "(", "f", "+", "1", ")", "*", "fs", ")", "/", "(", "2", "*", "nfft", ")", "for", "f", "in", "range", "(", "nfft", ")", "]", ...
This function initializes the chroma matrices used in the calculation of the chroma features
[ "This", "function", "initializes", "the", "chroma", "matrices", "used", "in", "the", "calculation", "of", "the", "chroma", "features" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L240-L255
train
This function initializes the chroma matrices used in the calculation of the chroma features
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stChromagram
def stChromagram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
python
def stChromagram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
[ "def", "stChromagram", "(", "signal", ",", "fs", ",", "win", ",", "step", ",", "PLOT", "=", "False", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term window size (in samples) step: the short-term win...
[ "Short", "-", "term", "FFT", "mag", "for", "spectogram", "estimation", ":", "Returns", ":", "a", "numpy", "array", "(", "nFFT", "x", "numOfShortTermWindows", ")", "ARGUMENTS", ":", "signal", ":", "the", "input", "signal", "samples", "fs", ":", "the", "samp...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L298-L365
train
Function that calculates the short - term FFT mag for spectogram estimation
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
beatExtraction
def beatExtraction(st_features, win_len, PLOT=False): """ This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates o...
python
def beatExtraction(st_features, win_len, PLOT=False): """ This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates o...
[ "def", "beatExtraction", "(", "st_features", ",", "win_len", ",", "PLOT", "=", "False", ")", ":", "# Features that are related to the beat tracking task:", "toWatch", "=", "[", "0", ",", "1", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",...
This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates of beats per minute - Ratio: a confidence measure
[ "This", "function", "extracts", "an", "estimate", "of", "the", "beat", "rate", "for", "a", "musical", "signal", ".", "ARGUMENTS", ":", "-", "st_features", ":", "a", "numpy", "array", "(", "n_feats", "x", "numOfShortTermWindows", ")", "-", "win_len", ":", "...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L392-L450
train
This function extracts the beat rate for a musical signal.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectogram
def stSpectogram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
python
def stSpectogram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
[ "def", "stSpectogram", "(", "signal", ",", "fs", ",", "win", ",", "step", ",", "PLOT", "=", "False", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term window size (in samples) step: the short-term win...
[ "Short", "-", "term", "FFT", "mag", "for", "spectogram", "estimation", ":", "Returns", ":", "a", "numpy", "array", "(", "nFFT", "x", "numOfShortTermWindows", ")", "ARGUMENTS", ":", "signal", ":", "the", "input", "signal", "samples", "fs", ":", "the", "samp...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L453-L515
train
This function calculates the short - term FFT for spectogram estimation
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stFeatureExtraction
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
python
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
[ "def", "stFeatureExtraction", "(", "signal", ",", "fs", ",", "win", ",", "step", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "# Signal normalization", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples fs: the sampling freq (in Hz) win: ...
[ "This", "function", "implements", "the", "shor", "-", "term", "windowing", "process", ".", "For", "each", "short", "-", "term", "window", "a", "set", "of", "features", "is", "extracted", ".", "This", "results", "to", "a", "sequence", "of", "feature", "vect...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L521-L614
train
This function extracts the features from a signal using the short - term windowing process.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mtFeatureExtraction
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
python
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
[ "def", "mtFeatureExtraction", "(", "signal", ",", "fs", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "mt_win_ratio", "=", "int", "(", "round", "(", "mt_win", "/", "st_step", ")", ")", "mt_step_ratio", "=", "int", "(", "round", ...
Mid-term feature extraction
[ "Mid", "-", "term", "feature", "extraction" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L617-L654
train
Mid - term feature extraction
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtraction
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
python
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
[ "def", "dirWavFeatureExtraction", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ",", "compute_beat", "=", "False", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "process_times", "=", "[", "]", "...
This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Therefore ONE FEATURE VECTOR is extracted for each WAV file. ARGUMENTS: - dirName: the path of the WAVE directory ...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L726-L799
train
This function extracts the mid - term features of a WAVE file in a particular folder.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirsWavFeatureExtraction
def dirsWavFeatureExtraction(dirNames, mt_win, mt_step, st_win, st_step, compute_beat=False): ''' Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtrac...
python
def dirsWavFeatureExtraction(dirNames, mt_win, mt_step, st_win, st_step, compute_beat=False): ''' Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtrac...
[ "def", "dirsWavFeatureExtraction", "(", "dirNames", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ",", "compute_beat", "=", "False", ")", ":", "# feature extraction for each class:", "features", "=", "[", "]", "classNames", "=", "[", "]", "fileNa...
Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtraction(['audioData/classSegmentsRec/noise','audioData/classSegmentsRec/speech', ...
[ "Same", "as", "dirWavFeatureExtraction", "but", "instead", "of", "a", "single", "dir", "it", "takes", "a", "list", "of", "paths", "as", "input", "and", "returns", "a", "list", "of", "feature", "matrices", ".", "EXAMPLE", ":", "[", "features", "classNames", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L802-L831
train
This function takes a list of files and directories and returns a list of feature matrices.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtractionNoAveraging
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
python
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
[ "def", "dirWavFeatureExtractionNoAveraging", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "signal_idx", "=", "numpy", ".", "array", "(", "[", "]", ...
This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: mid-term window and step (in seconds) - st_win, st_step: short-term window and step (...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "without", "averaging", "each", "file", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L834-L879
train
This function extracts the mid - term features of the WAVE files of a particular folder without averaging each file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mtFeatureExtractionToFile
def mtFeatureExtractionToFile(fileName, midTermSize, midTermStep, shortTermSize, shortTermStep, outPutFile, storeStFeatures=False, storeToCSV=False, PLOT=False): """ This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extract...
python
def mtFeatureExtractionToFile(fileName, midTermSize, midTermStep, shortTermSize, shortTermStep, outPutFile, storeStFeatures=False, storeToCSV=False, PLOT=False): """ This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extract...
[ "def", "mtFeatureExtractionToFile", "(", "fileName", ",", "midTermSize", ",", "midTermStep", ",", "shortTermSize", ",", "shortTermStep", ",", "outPutFile", ",", "storeStFeatures", "=", "False", ",", "storeToCSV", "=", "False", ",", "PLOT", "=", "False", ")", ":"...
This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extraction on that signal c) write the mid-term feature sequences to a numpy file
[ "This", "function", "is", "used", "as", "a", "wrapper", "to", ":", "a", ")", "read", "the", "content", "of", "a", "WAV", "file", "b", ")", "perform", "mid", "-", "term", "feature", "extraction", "on", "that", "signal", "c", ")", "write", "the", "mid"...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L889-L928
train
This function extracts the mid - term feature sequences from a WAV file and stores them to a numpy file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/base_account.py
BaseAccount.market_value
def market_value(self): """ [float] 市值 """ return sum(position.market_value for position in six.itervalues(self._positions))
python
def market_value(self): """ [float] 市值 """ return sum(position.market_value for position in six.itervalues(self._positions))
[ "def", "market_value", "(", "self", ")", ":", "return", "sum", "(", "position", ".", "market_value", "for", "position", "in", "six", ".", "itervalues", "(", "self", ".", "_positions", ")", ")" ]
[float] 市值
[ "[", "float", "]", "市值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/base_account.py#L103-L107
train
get the market value of all positions
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/base_account.py
BaseAccount.transaction_cost
def transaction_cost(self): """ [float] 总费用 """ return sum(position.transaction_cost for position in six.itervalues(self._positions))
python
def transaction_cost(self): """ [float] 总费用 """ return sum(position.transaction_cost for position in six.itervalues(self._positions))
[ "def", "transaction_cost", "(", "self", ")", ":", "return", "sum", "(", "position", ".", "transaction_cost", "for", "position", "in", "six", ".", "itervalues", "(", "self", ".", "_positions", ")", ")" ]
[float] 总费用
[ "[", "float", "]", "总费用" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/base_account.py#L110-L114
train
get total transaction cost
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
buy_open
def buy_open(id_or_ins, amount, price=None, style=None): """ 买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
python
def buy_open(id_or_ins, amount, price=None, style=None): """ 买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "def", "buy_open", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "return", "order", "(", "id_or_ins", ",", "amount", ",", "SIDE", ".", "BUY", ",", "POSITION_EFFECT", ".", "OPEN", ",", "cal_style", "(",...
买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :cla...
[ "买入开仓。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L208-L231
train
buy_open 上期所AG1607单开仓
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
buy_close
def buy_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要...
python
def buy_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要...
[ "def", "buy_close", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ",", "close_today", "=", "False", ")", ":", "position_effect", "=", "POSITION_EFFECT", ".", "CLOSE_TODAY", "if", "close_today", "else", "POSITION_EFFECT"...
平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :class...
[ "平卖仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L235-L261
train
buy_close - 单下单下单下单下单下单下单下单下单下单下单下单下单下单下单下�
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
sell_open
def sell_open(id_or_ins, amount, price=None, style=None): """ 卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
python
def sell_open(id_or_ins, amount, price=None, style=None): """ 卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "def", "sell_open", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "return", "order", "(", "id_or_ins", ",", "amount", ",", "SIDE", ".", "SELL", ",", "POSITION_EFFECT", ".", "OPEN", ",", "cal_style", "(...
卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :clas...
[ "卖出开仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L265-L281
train
Order to sell open.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
sell_close
def sell_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主...
python
def sell_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主...
[ "def", "sell_close", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ",", "close_today", "=", "False", ")", ":", "position_effect", "=", "POSITION_EFFECT", ".", "CLOSE_TODAY", "if", "close_today", "else", "POSITION_EFFECT...
平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :class...
[ "平买仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L285-L304
train
Order to sell close a market.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
get_future_contracts
def get_future_contracts(underlying_symbol): """ 获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In...
python
def get_future_contracts(underlying_symbol): """ 获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In...
[ "def", "get_future_contracts", "(", "underlying_symbol", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "return", "env", ".", "data_proxy", ".", "get_future_contracts", "(", "underlying_symbol", ",", "env", ".", "trading_dt", ")" ]
获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In] logger.info(get_future_contracts('IF')) ...
[ "获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L329-L349
train
get_future_contracts - Get all future contracts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/order.py
Order.quantity
def quantity(self): """ [int] 订单数量 """ if np.isnan(self._quantity): raise RuntimeError("Quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._quantity
python
def quantity(self): """ [int] 订单数量 """ if np.isnan(self._quantity): raise RuntimeError("Quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._quantity
[ "def", "quantity", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_quantity", ")", ":", "raise", "RuntimeError", "(", "\"Quantity of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")", ")", "return", ...
[int] 订单数量
[ "[", "int", "]", "订单数量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L156-L162
train
get quantity of the order
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/order.py
Order.filled_quantity
def filled_quantity(self): """ [int] 订单已成交数量 """ if np.isnan(self._filled_quantity): raise RuntimeError("Filled quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._filled_quantity
python
def filled_quantity(self): """ [int] 订单已成交数量 """ if np.isnan(self._filled_quantity): raise RuntimeError("Filled quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._filled_quantity
[ "def", "filled_quantity", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_filled_quantity", ")", ":", "raise", "RuntimeError", "(", "\"Filled quantity of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")",...
[int] 订单已成交数量
[ "[", "int", "]", "订单已成交数量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L200-L206
train
Returns the filled quantity of the order.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/order.py
Order.frozen_price
def frozen_price(self): """ [float] 冻结价格 """ if np.isnan(self._frozen_price): raise RuntimeError("Frozen price of order {} is not supposed to be nan.".format(self.order_id)) return self._frozen_price
python
def frozen_price(self): """ [float] 冻结价格 """ if np.isnan(self._frozen_price): raise RuntimeError("Frozen price of order {} is not supposed to be nan.".format(self.order_id)) return self._frozen_price
[ "def", "frozen_price", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_frozen_price", ")", ":", "raise", "RuntimeError", "(", "\"Frozen price of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")", ")", ...
[float] 冻结价格
[ "[", "float", "]", "冻结价格" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L244-L250
train
Returns the frozen price of the order.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/tick.py
TickObject.datetime
def datetime(self): """ [datetime.datetime] 当前快照数据的时间戳 """ try: dt = self._tick_dict['datetime'] except (KeyError, ValueError): return datetime.datetime.min else: if not isinstance(dt, datetime.datetime): if dt > 1000000...
python
def datetime(self): """ [datetime.datetime] 当前快照数据的时间戳 """ try: dt = self._tick_dict['datetime'] except (KeyError, ValueError): return datetime.datetime.min else: if not isinstance(dt, datetime.datetime): if dt > 1000000...
[ "def", "datetime", "(", "self", ")", ":", "try", ":", "dt", "=", "self", ".", "_tick_dict", "[", "'datetime'", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "return", "datetime", ".", "datetime", ".", "min", "else", ":", "if", "not", "...
[datetime.datetime] 当前快照数据的时间戳
[ "[", "datetime", ".", "datetime", "]", "当前快照数据的时间戳" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/tick.py#L44-L58
train
Returns datetime. datetime.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.value_percent
def value_percent(self): """ [float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1] """ accounts = Environment.get_instance().portfolio.accounts if DEFAULT_ACCOUNT_TYPE.STOCK.name not in accounts: return 0 total_value = accounts[DEFAULT_ACCOUNT_TYPE.STOCK.name].total_v...
python
def value_percent(self): """ [float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1] """ accounts = Environment.get_instance().portfolio.accounts if DEFAULT_ACCOUNT_TYPE.STOCK.name not in accounts: return 0 total_value = accounts[DEFAULT_ACCOUNT_TYPE.STOCK.name].total_v...
[ "def", "value_percent", "(", "self", ")", ":", "accounts", "=", "Environment", ".", "get_instance", "(", ")", ".", "portfolio", ".", "accounts", "if", "DEFAULT_ACCOUNT_TYPE", ".", "STOCK", ".", "name", "not", "in", "accounts", ":", "return", "0", "total_valu...
[float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1]
[ "[", "float", "]", "获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围", "[", "0", "1", "]" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L155-L163
train
get the value of the current asset
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.is_de_listed
def is_de_listed(self): """ 判断合约是否过期 """ env = Environment.get_instance() instrument = env.get_instrument(self._order_book_id) current_date = env.trading_dt if instrument.de_listed_date is not None: if instrument.de_listed_date.date() > env.config.bas...
python
def is_de_listed(self): """ 判断合约是否过期 """ env = Environment.get_instance() instrument = env.get_instrument(self._order_book_id) current_date = env.trading_dt if instrument.de_listed_date is not None: if instrument.de_listed_date.date() > env.config.bas...
[ "def", "is_de_listed", "(", "self", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "instrument", "=", "env", ".", "get_instrument", "(", "self", ".", "_order_book_id", ")", "current_date", "=", "env", ".", "trading_dt", "if", "instrument...
判断合约是否过期
[ "判断合约是否过期" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L166-L179
train
Returns True if the order book is marked as de - listed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.bought_value
def bought_value(self): """ [已弃用] """ user_system_log.warn(_(u"[abandon] {} is no longer valid.").format('stock_position.bought_value')) return self._quantity * self._avg_price
python
def bought_value(self): """ [已弃用] """ user_system_log.warn(_(u"[abandon] {} is no longer valid.").format('stock_position.bought_value')) return self._quantity * self._avg_price
[ "def", "bought_value", "(", "self", ")", ":", "user_system_log", ".", "warn", "(", "_", "(", "u\"[abandon] {} is no longer valid.\"", ")", ".", "format", "(", "'stock_position.bought_value'", ")", ")", "return", "self", ".", "_quantity", "*", "self", ".", "_avg_...
[已弃用]
[ "[", "已弃用", "]" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L200-L205
train
get the bought value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/booking.py
BookingPosition.trading_pnl
def trading_pnl(self): """ [float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) return self._contract_multiplier * (self._trade_quantity * last_price - self._trade_cost)
python
def trading_pnl(self): """ [float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) return self._contract_multiplier * (self._trade_quantity * last_price - self._trade_cost)
[ "def", "trading_pnl", "(", "self", ")", ":", "last_price", "=", "self", ".", "_data_proxy", ".", "get_last_price", "(", "self", ".", "_order_book_id", ")", "return", "self", ".", "_contract_multiplier", "*", "(", "self", ".", "_trade_quantity", "*", "last_pric...
[float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分
[ "[", "float", "]", "交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/booking.py#L223-L228
train
get the price of the last trade
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/booking.py
BookingPosition.position_pnl
def position_pnl(self): """ [float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) if self._direction == POSITION_DIRECTION.LONG: price_spread = last_price - self._last_price else: price_spread = s...
python
def position_pnl(self): """ [float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) if self._direction == POSITION_DIRECTION.LONG: price_spread = last_price - self._last_price else: price_spread = s...
[ "def", "position_pnl", "(", "self", ")", ":", "last_price", "=", "self", ".", "_data_proxy", ".", "get_last_price", "(", "self", ".", "_order_book_id", ")", "if", "self", ".", "_direction", "==", "POSITION_DIRECTION", ".", "LONG", ":", "price_spread", "=", "...
[float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分
[ "[", "float", "]", "昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/booking.py#L231-L241
train
Returns the PNL of the order book.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.register_event
def register_event(self): """ 注册事件 """ event_bus = Environment.get_instance().event_bus event_bus.prepend_listener(EVENT.PRE_BEFORE_TRADING, self._pre_before_trading) event_bus.prepend_listener(EVENT.POST_SETTLEMENT, self._post_settlement)
python
def register_event(self): """ 注册事件 """ event_bus = Environment.get_instance().event_bus event_bus.prepend_listener(EVENT.PRE_BEFORE_TRADING, self._pre_before_trading) event_bus.prepend_listener(EVENT.POST_SETTLEMENT, self._post_settlement)
[ "def", "register_event", "(", "self", ")", ":", "event_bus", "=", "Environment", ".", "get_instance", "(", ")", ".", "event_bus", "event_bus", ".", "prepend_listener", "(", "EVENT", ".", "PRE_BEFORE_TRADING", ",", "self", ".", "_pre_before_trading", ")", "event_...
注册事件
[ "注册事件" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L41-L47
train
Register the event bus.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.unit_net_value
def unit_net_value(self): """ [float] 实时净值 """ if self._units == 0: return np.nan return self.total_value / self._units
python
def unit_net_value(self): """ [float] 实时净值 """ if self._units == 0: return np.nan return self.total_value / self._units
[ "def", "unit_net_value", "(", "self", ")", ":", "if", "self", ".", "_units", "==", "0", ":", "return", "np", ".", "nan", "return", "self", ".", "total_value", "/", "self", ".", "_units" ]
[float] 实时净值
[ "[", "float", "]", "实时净值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L119-L125
train
Returns the unit net value of the current time series.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.daily_returns
def daily_returns(self): """ [float] 当前最新一天的日收益 """ if self._static_unit_net_value == 0: return np.nan return 0 if self._static_unit_net_value == 0 else self.unit_net_value / self._static_unit_net_value - 1
python
def daily_returns(self): """ [float] 当前最新一天的日收益 """ if self._static_unit_net_value == 0: return np.nan return 0 if self._static_unit_net_value == 0 else self.unit_net_value / self._static_unit_net_value - 1
[ "def", "daily_returns", "(", "self", ")", ":", "if", "self", ".", "_static_unit_net_value", "==", "0", ":", "return", "np", ".", "nan", "return", "0", "if", "self", ".", "_static_unit_net_value", "==", "0", "else", "self", ".", "unit_net_value", "/", "self...
[float] 当前最新一天的日收益
[ "[", "float", "]", "当前最新一天的日收益" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L139-L145
train
Returns the daily returns of the current time series.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.total_value
def total_value(self): """ [float]总权益 """ return sum(account.total_value for account in six.itervalues(self._accounts))
python
def total_value(self): """ [float]总权益 """ return sum(account.total_value for account in six.itervalues(self._accounts))
[ "def", "total_value", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "total_value", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float]总权益
[ "[", "float", "]", "总权益" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L167-L171
train
get total value of all the items in the cache
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.positions
def positions(self): """ [dict] 持仓 """ if self._mixed_positions is None: self._mixed_positions = MixedPositions(self._accounts) return self._mixed_positions
python
def positions(self): """ [dict] 持仓 """ if self._mixed_positions is None: self._mixed_positions = MixedPositions(self._accounts) return self._mixed_positions
[ "def", "positions", "(", "self", ")", ":", "if", "self", ".", "_mixed_positions", "is", "None", ":", "self", ".", "_mixed_positions", "=", "MixedPositions", "(", "self", ".", "_accounts", ")", "return", "self", ".", "_mixed_positions" ]
[dict] 持仓
[ "[", "dict", "]", "持仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L181-L187
train
get the set of mixed positions
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.cash
def cash(self): """ [float] 可用资金 """ return sum(account.cash for account in six.itervalues(self._accounts))
python
def cash(self): """ [float] 可用资金 """ return sum(account.cash for account in six.itervalues(self._accounts))
[ "def", "cash", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "cash", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float] 可用资金
[ "[", "float", "]", "可用资金" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L190-L194
train
get the cash of all the accounts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.market_value
def market_value(self): """ [float] 市值 """ return sum(account.market_value for account in six.itervalues(self._accounts))
python
def market_value(self): """ [float] 市值 """ return sum(account.market_value for account in six.itervalues(self._accounts))
[ "def", "market_value", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "market_value", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float] 市值
[ "[", "float", "]", "市值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L205-L209
train
get the market value of all accounts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_holding_pnl
def buy_holding_pnl(self): """ [float] 买方向当日持仓盈亏 """ return (self.last_price - self.buy_avg_holding_price) * self.buy_quantity * self.contract_multiplier
python
def buy_holding_pnl(self): """ [float] 买方向当日持仓盈亏 """ return (self.last_price - self.buy_avg_holding_price) * self.buy_quantity * self.contract_multiplier
[ "def", "buy_holding_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "last_price", "-", "self", ".", "buy_avg_holding_price", ")", "*", "self", ".", "buy_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 买方向当日持仓盈亏
[ "[", "float", "]", "买方向当日持仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L107-L111
train
get holding price in ppnl
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_holding_pnl
def sell_holding_pnl(self): """ [float] 卖方向当日持仓盈亏 """ return (self.sell_avg_holding_price - self.last_price) * self.sell_quantity * self.contract_multiplier
python
def sell_holding_pnl(self): """ [float] 卖方向当日持仓盈亏 """ return (self.sell_avg_holding_price - self.last_price) * self.sell_quantity * self.contract_multiplier
[ "def", "sell_holding_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "sell_avg_holding_price", "-", "self", ".", "last_price", ")", "*", "self", ".", "sell_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 卖方向当日持仓盈亏
[ "[", "float", "]", "卖方向当日持仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L114-L118
train
get sell holding price
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_pnl
def buy_pnl(self): """ [float] 买方向累计盈亏 """ return (self.last_price - self._buy_avg_open_price) * self.buy_quantity * self.contract_multiplier
python
def buy_pnl(self): """ [float] 买方向累计盈亏 """ return (self.last_price - self._buy_avg_open_price) * self.buy_quantity * self.contract_multiplier
[ "def", "buy_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "last_price", "-", "self", ".", "_buy_avg_open_price", ")", "*", "self", ".", "buy_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 买方向累计盈亏
[ "[", "float", "]", "买方向累计盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L170-L174
train
get buy price in ppnl
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_pnl
def sell_pnl(self): """ [float] 卖方向累计盈亏 """ return (self._sell_avg_open_price - self.last_price) * self.sell_quantity * self.contract_multiplier
python
def sell_pnl(self): """ [float] 卖方向累计盈亏 """ return (self._sell_avg_open_price - self.last_price) * self.sell_quantity * self.contract_multiplier
[ "def", "sell_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "_sell_avg_open_price", "-", "self", ".", "last_price", ")", "*", "self", ".", "sell_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 卖方向累计盈亏
[ "[", "float", "]", "卖方向累计盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L177-L181
train
get sell price
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_open_order_quantity
def buy_open_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect == POSITION_EFFECT.OPEN)
python
def buy_open_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect == POSITION_EFFECT.OPEN)
[ "def", "buy_open_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "BUY", "and", "order", ".", "position_effect", ...
[int] 买方向挂单量
[ "[", "int", "]", "买方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L192-L197
train
get buy open order quantity
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_open_order_quantity
def sell_open_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect == POSITION_EFFECT.OPEN)
python
def sell_open_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect == POSITION_EFFECT.OPEN)
[ "def", "sell_open_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "SELL", "and", "order", ".", "position_effect"...
[int] 卖方向挂单量
[ "[", "int", "]", "卖方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L200-L205
train
get sell open order quantity
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_close_order_quantity
def buy_close_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
python
def buy_close_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
[ "def", "buy_close_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "BUY", "and", "order", ".", "position_effect",...
[int] 买方向挂单量
[ "[", "int", "]", "买方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L208-L213
train
get buy close order quantity
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_close_order_quantity
def sell_close_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
python
def sell_close_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
[ "def", "sell_close_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "SELL", "and", "order", ".", "position_effect...
[int] 卖方向挂单量
[ "[", "int", "]", "卖方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L216-L221
train
get_unfilled_quantity 卖方向挂单量
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_avg_holding_price
def buy_avg_holding_price(self): """ [float] 买方向持仓均价 """ return 0 if self.buy_quantity == 0 else self._buy_holding_cost / self.buy_quantity / self.contract_multiplier
python
def buy_avg_holding_price(self): """ [float] 买方向持仓均价 """ return 0 if self.buy_quantity == 0 else self._buy_holding_cost / self.buy_quantity / self.contract_multiplier
[ "def", "buy_avg_holding_price", "(", "self", ")", ":", "return", "0", "if", "self", ".", "buy_quantity", "==", "0", "else", "self", ".", "_buy_holding_cost", "/", "self", ".", "buy_quantity", "/", "self", ".", "contract_multiplier" ]
[float] 买方向持仓均价
[ "[", "float", "]", "买方向持仓均价" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L322-L326
train
get avg holding price of buy
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_avg_holding_price
def sell_avg_holding_price(self): """ [float] 卖方向持仓均价 """ return 0 if self.sell_quantity == 0 else self._sell_holding_cost / self.sell_quantity / self.contract_multiplier
python
def sell_avg_holding_price(self): """ [float] 卖方向持仓均价 """ return 0 if self.sell_quantity == 0 else self._sell_holding_cost / self.sell_quantity / self.contract_multiplier
[ "def", "sell_avg_holding_price", "(", "self", ")", ":", "return", "0", "if", "self", ".", "sell_quantity", "==", "0", "else", "self", ".", "_sell_holding_cost", "/", "self", ".", "sell_quantity", "/", "self", ".", "contract_multiplier" ]
[float] 卖方向持仓均价
[ "[", "float", "]", "卖方向持仓均价" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L329-L333
train
get the avg holding price of sell
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.is_de_listed
def is_de_listed(self): """ 判断合约是否过期 """ instrument = Environment.get_instance().get_instrument(self._order_book_id) current_date = Environment.get_instance().trading_dt if instrument.de_listed_date is not None and current_date >= instrument.de_listed_date: re...
python
def is_de_listed(self): """ 判断合约是否过期 """ instrument = Environment.get_instance().get_instrument(self._order_book_id) current_date = Environment.get_instance().trading_dt if instrument.de_listed_date is not None and current_date >= instrument.de_listed_date: re...
[ "def", "is_de_listed", "(", "self", ")", ":", "instrument", "=", "Environment", ".", "get_instance", "(", ")", ".", "get_instrument", "(", "self", ".", "_order_book_id", ")", "current_date", "=", "Environment", ".", "get_instance", "(", ")", ".", "trading_dt",...
判断合约是否过期
[ "判断合约是否过期" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L372-L380
train
Returns True if the order book is marked as de - listed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.apply_trade
def apply_trade(self, trade): """ 应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of c...
python
def apply_trade(self, trade): """ 应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of c...
[ "def", "apply_trade", "(", "self", ",", "trade", ")", ":", "# close_trade: delta_cash = old_margin - margin + delta_realized_pnl", "trade_quantity", "=", "trade", ".", "last_quantity", "if", "trade", ".", "side", "==", "SIDE", ".", "BUY", ":", "if", "trade", ".", ...
应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of closed trade) * contract_multiplier * margin_rate +...
[ "应用成交,并计算交易产生的现金变动。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L411-L455
train
Apply a trade to the current state.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition._close_holding
def _close_holding(self, trade): """ 应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier ...
python
def _close_holding(self, trade): """ 应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier ...
[ "def", "_close_holding", "(", "self", ",", "trade", ")", ":", "left_quantity", "=", "trade", ".", "last_quantity", "delta", "=", "0", "if", "trade", ".", "side", "==", "SIDE", ".", "BUY", ":", "# 先平昨仓", "if", "trade", ".", "position_effect", "==", "POSIT...
应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier :param trade: rqalpha.model.trade.Trade ...
[ "应用平仓,并计算平仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L457-L520
train
Private method that returns the amount of close holding trades.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.sector_code
def sector_code(self): """ [str] 板块缩写代码,全球通用标准定义(股票专用) """ try: return self.__dict__["sector_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code' ".format(self.order_book_i...
python
def sector_code(self): """ [str] 板块缩写代码,全球通用标准定义(股票专用) """ try: return self.__dict__["sector_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code' ".format(self.order_book_i...
[ "def", "sector_code", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"sector_code\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'sector_...
[str] 板块缩写代码,全球通用标准定义(股票专用)
[ "[", "str", "]", "板块缩写代码,全球通用标准定义(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L116-L125
train
get the sector code of the instrument
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.sector_code_name
def sector_code_name(self): """ [str] 以当地语言为标准的板块代码名(股票专用) """ try: return self.__dict__["sector_code_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code_name' ".format(sel...
python
def sector_code_name(self): """ [str] 以当地语言为标准的板块代码名(股票专用) """ try: return self.__dict__["sector_code_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code_name' ".format(sel...
[ "def", "sector_code_name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"sector_code_name\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribut...
[str] 以当地语言为标准的板块代码名(股票专用)
[ "[", "str", "]", "以当地语言为标准的板块代码名(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L128-L137
train
return the name of the sector code
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.industry_code
def industry_code(self): """ [str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用) """ try: return self.__dict__["industry_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_code' ".form...
python
def industry_code(self): """ [str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用) """ try: return self.__dict__["industry_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_code' ".form...
[ "def", "industry_code", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"industry_code\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'ind...
[str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用)
[ "[", "str", "]", "国民经济行业分类代码,具体可参考“Industry列表”", "(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L140-L149
train
Return the Industry code for this instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.industry_name
def industry_name(self): """ [str] 国民经济行业分类名称(股票专用) """ try: return self.__dict__["industry_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_name' ".format(self.order_book_...
python
def industry_name(self): """ [str] 国民经济行业分类名称(股票专用) """ try: return self.__dict__["industry_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_name' ".format(self.order_book_...
[ "def", "industry_name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"industry_name\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'ind...
[str] 国民经济行业分类名称(股票专用)
[ "[", "str", "]", "国民经济行业分类名称(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L152-L161
train
return industry_name of this instrument
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.concept_names
def concept_names(self): """ [str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用) """ try: return self.__dict__["concept_names"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'concept_names' ".format(sel...
python
def concept_names(self): """ [str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用) """ try: return self.__dict__["concept_names"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'concept_names' ".format(sel...
[ "def", "concept_names", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"concept_names\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'con...
[str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用)
[ "[", "str", "]", "概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L164-L173
train
return a list of concept names
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.board_type
def board_type(self): """ [str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用) """ try: return self.__dict__["board_type"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'board_type' ".format(se...
python
def board_type(self): """ [str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用) """ try: return self.__dict__["board_type"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'board_type' ".format(se...
[ "def", "board_type", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"board_type\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'board_typ...
[str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用)
[ "[", "str", "]", "板块类别,’MainBoard’", "-", "主板", "’GEM’", "-", "创业板(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L176-L185
train
Returns the board type of the instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.status
def status(self): """ [str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用) """ try: return self.__dict__["status"] except (KeyError, ValueError): raise AttributeError( ...
python
def status(self): """ [str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用) """ try: return self.__dict__["status"] except (KeyError, ValueError): raise AttributeError( ...
[ "def", "status", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"status\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'status' \"", "....
[str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用)
[ "[", "str", "]", "合约状态。’Active’", "-", "正常上市", "‘Delisted’", "-", "终止上市", "‘TemporarySuspended’", "-", "暂停上市", "‘PreIPO’", "-", "发行配售期间", "‘FailIPO’", "-", "发行失败(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L188-L198
train
Return the status of the instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.special_type
def special_type(self): """ [str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用) """ try: return self.__dict__["special_type"] except (KeyError, ValueError): raise AttributeError( ...
python
def special_type(self): """ [str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用) """ try: return self.__dict__["special_type"] except (KeyError, ValueError): raise AttributeError( ...
[ "def", "special_type", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"special_type\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'speci...
[str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用)
[ "[", "str", "]", "特别处理状态。’Normal’", "-", "正常上市", "‘ST’", "-", "ST处理", "‘StarST’", "-", "*", "ST代表该股票正在接受退市警告", "‘PT’", "-", "代表该股票连续3年收入为负,将被暂停交易", "‘Other’", "-", "其他(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L201-L211
train
Return the special type of the instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.contract_multiplier
def contract_multiplier(self): """ [float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用) """ try: return self.__dict__["contract_multiplier"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'contract_mu...
python
def contract_multiplier(self): """ [float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用) """ try: return self.__dict__["contract_multiplier"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'contract_mu...
[ "def", "contract_multiplier", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"contract_multiplier\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no at...
[float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用)
[ "[", "float", "]", "合约乘数,例如沪深300股指期货的乘数为300", ".", "0(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L214-L223
train
get the contract multiplier
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.margin_rate
def margin_rate(self): """ [float] 合约最低保证金率(期货专用) """ try: return self.__dict__["margin_rate"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'margin_rate' ".format(self.order_book_id) ...
python
def margin_rate(self): """ [float] 合约最低保证金率(期货专用) """ try: return self.__dict__["margin_rate"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'margin_rate' ".format(self.order_book_id) ...
[ "def", "margin_rate", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"margin_rate\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'margin_...
[float] 合约最低保证金率(期货专用)
[ "[", "float", "]", "合约最低保证金率(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L226-L235
train
get the margin rate of the instrument
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.underlying_order_book_id
def underlying_order_book_id(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_order_book_id"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={})...
python
def underlying_order_book_id(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_order_book_id"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={})...
[ "def", "underlying_order_book_id", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"underlying_order_book_id\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={})...
[str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用)
[ "[", "str", "]", "合约标的代码,目前除股指期货", "(", "IH", "IF", "IC", ")", "之外的期货合约,这一字段全部为’null’(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L238-L247
train
Return the order book ID of the current instance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.underlying_symbol
def underlying_symbol(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_symbol"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attrib...
python
def underlying_symbol(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_symbol"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attrib...
[ "def", "underlying_symbol", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"underlying_symbol\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attrib...
[str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用)
[ "[", "str", "]", "合约标的代码,目前除股指期货", "(", "IH", "IF", "IC", ")", "之外的期货合约,这一字段全部为’null’(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L250-L259
train
Return the underlying symbol of the instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.maturity_date
def maturity_date(self): """ [datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用) """ try: return self.__dict__["maturity_date"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'm...
python
def maturity_date(self): """ [datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用) """ try: return self.__dict__["maturity_date"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'm...
[ "def", "maturity_date", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"maturity_date\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'mat...
[datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用)
[ "[", "datetime", "]", "期货到期日。主力连续合约与指数连续合约都为", "datetime", "(", "2999", "12", "31", ")", "(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L262-L271
train
Return the date of the instrument that maturity was performed on.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.settlement_method
def settlement_method(self): """ [str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用) """ try: return self.__dict__["settlement_method"] except (KeyError, ValueError): raise AttributeError( "Instrument(order...
python
def settlement_method(self): """ [str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用) """ try: return self.__dict__["settlement_method"] except (KeyError, ValueError): raise AttributeError( "Instrument(order...
[ "def", "settlement_method", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"settlement_method\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attrib...
[str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用)
[ "[", "str", "]", "交割方式,’CashSettlementRequired’", "-", "现金交割", "‘PhysicalSettlementRequired’", "-", "实物交割(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L274-L283
train
Return the settlement method of the current instrument.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.listing
def listing(self): """ [bool] 该合约当前日期是否在交易 """ now = Environment.get_instance().calendar_dt return self.listed_date <= now <= self.de_listed_date
python
def listing(self): """ [bool] 该合约当前日期是否在交易 """ now = Environment.get_instance().calendar_dt return self.listed_date <= now <= self.de_listed_date
[ "def", "listing", "(", "self", ")", ":", "now", "=", "Environment", ".", "get_instance", "(", ")", ".", "calendar_dt", "return", "self", ".", "listed_date", "<=", "now", "<=", "self", ".", "de_listed_date" ]
[bool] 该合约当前日期是否在交易
[ "[", "bool", "]", "该合约当前日期是否在交易" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L286-L292
train
Returns True if the user is listing the user s entries.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py
StockTransactionCostDecider.get_trade_commission
def get_trade_commission(self, trade): """ 计算手续费这个逻辑比较复杂,按照如下算法来计算: 1. 定义一个剩余手续费的概念,根据order_id存储在commission_map中,默认为min_commission 2. 当trade来时计算该trade产生的手续费cost_money 3. 如果cost_money > commission 3.1 如果commission 等于 min_commission,说明这是第一笔trade,此时,直接commission置0,返回c...
python
def get_trade_commission(self, trade): """ 计算手续费这个逻辑比较复杂,按照如下算法来计算: 1. 定义一个剩余手续费的概念,根据order_id存储在commission_map中,默认为min_commission 2. 当trade来时计算该trade产生的手续费cost_money 3. 如果cost_money > commission 3.1 如果commission 等于 min_commission,说明这是第一笔trade,此时,直接commission置0,返回c...
[ "def", "get_trade_commission", "(", "self", ",", "trade", ")", ":", "order_id", "=", "trade", ".", "order_id", "if", "self", ".", "env", ".", "data_proxy", ".", "instruments", "(", "trade", ".", "order_book_id", ")", ".", "type", "==", "'PublicFund'", ":",...
计算手续费这个逻辑比较复杂,按照如下算法来计算: 1. 定义一个剩余手续费的概念,根据order_id存储在commission_map中,默认为min_commission 2. 当trade来时计算该trade产生的手续费cost_money 3. 如果cost_money > commission 3.1 如果commission 等于 min_commission,说明这是第一笔trade,此时,直接commission置0,返回cost_money即可 3.2 如果commission 不等于 min_commission...
[ "计算手续费这个逻辑比较复杂,按照如下算法来计算:", "1", ".", "定义一个剩余手续费的概念,根据order_id存储在commission_map中,默认为min_commission", "2", ".", "当trade来时计算该trade产生的手续费cost_money", "3", ".", "如果cost_money", ">", "commission", "3", ".", "1", "如果commission", "等于", "min_commission,说明这是第一笔trade,此时,直接commission置0,返回cost...
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py#L50-L80
train
get_trade_commission - Returns the commission of the given trade
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py
HKStockTransactionCostDecider._get_tax
def _get_tax(self, order_book_id, _, cost_money): """ 港交所收费项目繁多,按照如下逻辑计算税费: 1. 税费比例为 0.11%,不足 1 元按 1 元记,四舍五入保留两位小数(包括印花税、交易征费、交易系统使用费)。 2,五元固定费用(包括卖方收取的转手纸印花税、买方收取的过户费用)。 """ instrument = Environment.get_instance().get_instrument(order_book_id) if instrument.type ...
python
def _get_tax(self, order_book_id, _, cost_money): """ 港交所收费项目繁多,按照如下逻辑计算税费: 1. 税费比例为 0.11%,不足 1 元按 1 元记,四舍五入保留两位小数(包括印花税、交易征费、交易系统使用费)。 2,五元固定费用(包括卖方收取的转手纸印花税、买方收取的过户费用)。 """ instrument = Environment.get_instance().get_instrument(order_book_id) if instrument.type ...
[ "def", "_get_tax", "(", "self", ",", "order_book_id", ",", "_", ",", "cost_money", ")", ":", "instrument", "=", "Environment", ".", "get_instance", "(", ")", ".", "get_instrument", "(", "order_book_id", ")", "if", "instrument", ".", "type", "!=", "'CS'", "...
港交所收费项目繁多,按照如下逻辑计算税费: 1. 税费比例为 0.11%,不足 1 元按 1 元记,四舍五入保留两位小数(包括印花税、交易征费、交易系统使用费)。 2,五元固定费用(包括卖方收取的转手纸印花税、买方收取的过户费用)。
[ "港交所收费项目繁多,按照如下逻辑计算税费:", "1", ".", "税费比例为", "0", ".", "11%,不足", "1", "元按", "1", "元记,四舍五入保留两位小数(包括印花税、交易征费、交易系统使用费)。", "2,五元固定费用(包括卖方收取的转手纸印花税、买方收取的过户费用)。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_transaction_cost/deciders.py#L108-L122
train
Get the tax for a given orderbook.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/bar.py
BarObject.prev_close
def prev_close(self): """ [float] 昨日收盘价 """ try: return self._data['prev_close'] except (ValueError, KeyError): pass if self._prev_close is None: trading_dt = Environment.get_instance().trading_dt data_proxy = Environment.g...
python
def prev_close(self): """ [float] 昨日收盘价 """ try: return self._data['prev_close'] except (ValueError, KeyError): pass if self._prev_close is None: trading_dt = Environment.get_instance().trading_dt data_proxy = Environment.g...
[ "def", "prev_close", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_data", "[", "'prev_close'", "]", "except", "(", "ValueError", ",", "KeyError", ")", ":", "pass", "if", "self", ".", "_prev_close", "is", "None", ":", "trading_dt", "=", "E...
[float] 昨日收盘价
[ "[", "float", "]", "昨日收盘价" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/bar.py#L91-L104
train
get previous close
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/bar.py
BarObject._bar_status
def _bar_status(self): """ WARNING: 获取 bar_status 比较耗费性能,而且是lazy_compute,因此不要多次调用!!!! """ if self.isnan or np.isnan(self.limit_up): return BAR_STATUS.ERROR if self.close >= self.limit_up: return BAR_STATUS.LIMIT_UP if self.close <= self.limit_down:...
python
def _bar_status(self): """ WARNING: 获取 bar_status 比较耗费性能,而且是lazy_compute,因此不要多次调用!!!! """ if self.isnan or np.isnan(self.limit_up): return BAR_STATUS.ERROR if self.close >= self.limit_up: return BAR_STATUS.LIMIT_UP if self.close <= self.limit_down:...
[ "def", "_bar_status", "(", "self", ")", ":", "if", "self", ".", "isnan", "or", "np", ".", "isnan", "(", "self", ".", "limit_up", ")", ":", "return", "BAR_STATUS", ".", "ERROR", "if", "self", ".", "close", ">=", "self", ".", "limit_up", ":", "return",...
WARNING: 获取 bar_status 比较耗费性能,而且是lazy_compute,因此不要多次调用!!!!
[ "WARNING", ":", "获取", "bar_status", "比较耗费性能,而且是lazy_compute,因此不要多次调用!!!!" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/bar.py#L107-L117
train
Return bar status.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/model/bar.py
BarObject.prev_settlement
def prev_settlement(self): """ [float] 昨日结算价(期货专用) """ try: return self._data['prev_settlement'] except (ValueError, KeyError): pass if self._prev_settlement is None: trading_dt = Environment.get_instance().trading_dt data_...
python
def prev_settlement(self): """ [float] 昨日结算价(期货专用) """ try: return self._data['prev_settlement'] except (ValueError, KeyError): pass if self._prev_settlement is None: trading_dt = Environment.get_instance().trading_dt data_...
[ "def", "prev_settlement", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_data", "[", "'prev_settlement'", "]", "except", "(", "ValueError", ",", "KeyError", ")", ":", "pass", "if", "self", ".", "_prev_settlement", "is", "None", ":", "trading_d...
[float] 昨日结算价(期货专用)
[ "[", "float", "]", "昨日结算价(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/bar.py#L180-L193
train
get the previous settlement
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
submit_order
def submit_order(id_or_ins, amount, side, price=None, position_effect=None): """ 通用下单函数,策略可以通过该函数自由选择参数下单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param float amount: 下单量,需为正数 :param side: 多空方向,多(SIDE.BUY)或空(SIDE.SELL) :type side: :class:`~SIDE` enum ...
python
def submit_order(id_or_ins, amount, side, price=None, position_effect=None): """ 通用下单函数,策略可以通过该函数自由选择参数下单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param float amount: 下单量,需为正数 :param side: 多空方向,多(SIDE.BUY)或空(SIDE.SELL) :type side: :class:`~SIDE` enum ...
[ "def", "submit_order", "(", "id_or_ins", ",", "amount", ",", "side", ",", "price", "=", "None", ",", "position_effect", "=", "None", ")", ":", "order_book_id", "=", "assure_order_book_id", "(", "id_or_ins", ")", "env", "=", "Environment", ".", "get_instance", ...
通用下单函数,策略可以通过该函数自由选择参数下单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param float amount: 下单量,需为正数 :param side: 多空方向,多(SIDE.BUY)或空(SIDE.SELL) :type side: :class:`~SIDE` enum :param float price: 下单价格,默认为None,表示市价单 :param position_effect: 开平方向,开仓(POSITION...
[ "通用下单函数,策略可以通过该函数自由选择参数下单。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L224-L291
train
Submit order to the order_list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
cancel_order
def cancel_order(order): """ 撤单 :param order: 需要撤销的order对象 :type order: :class:`~Order` object """ env = Environment.get_instance() if env.can_cancel_order(order): env.broker.cancel_order(order) return order
python
def cancel_order(order): """ 撤单 :param order: 需要撤销的order对象 :type order: :class:`~Order` object """ env = Environment.get_instance() if env.can_cancel_order(order): env.broker.cancel_order(order) return order
[ "def", "cancel_order", "(", "order", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "if", "env", ".", "can_cancel_order", "(", "order", ")", ":", "env", ".", "broker", ".", "cancel_order", "(", "order", ")", "return", "order" ]
撤单 :param order: 需要撤销的order对象 :type order: :class:`~Order` object
[ "撤单" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L304-L314
train
cancel order if it is available
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
update_universe
def update_universe(id_or_symbols): """ 该方法用于更新现在关注的证券的集合(e.g.:股票池)。PS:会在下一个bar事件触发时候产生(新的关注的股票池更新)效果。并且update_universe会是覆盖(overwrite)的操作而不是在已有的股票池的基础上进行增量添加。比如已有的股票池为['000001.XSHE', '000024.XSHE']然后调用了update_universe(['000030.XSHE'])之后,股票池就会变成000030.XSHE一个股票了,随后的数据更新也只会跟踪000030.XSHE这一个股票了。 :param id_or_sy...
python
def update_universe(id_or_symbols): """ 该方法用于更新现在关注的证券的集合(e.g.:股票池)。PS:会在下一个bar事件触发时候产生(新的关注的股票池更新)效果。并且update_universe会是覆盖(overwrite)的操作而不是在已有的股票池的基础上进行增量添加。比如已有的股票池为['000001.XSHE', '000024.XSHE']然后调用了update_universe(['000030.XSHE'])之后,股票池就会变成000030.XSHE一个股票了,随后的数据更新也只会跟踪000030.XSHE这一个股票了。 :param id_or_sy...
[ "def", "update_universe", "(", "id_or_symbols", ")", ":", "if", "isinstance", "(", "id_or_symbols", ",", "(", "six", ".", "string_types", ",", "Instrument", ")", ")", ":", "id_or_symbols", "=", "[", "id_or_symbols", "]", "order_book_ids", "=", "set", "(", "a...
该方法用于更新现在关注的证券的集合(e.g.:股票池)。PS:会在下一个bar事件触发时候产生(新的关注的股票池更新)效果。并且update_universe会是覆盖(overwrite)的操作而不是在已有的股票池的基础上进行增量添加。比如已有的股票池为['000001.XSHE', '000024.XSHE']然后调用了update_universe(['000030.XSHE'])之后,股票池就会变成000030.XSHE一个股票了,随后的数据更新也只会跟踪000030.XSHE这一个股票了。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Ins...
[ "该方法用于更新现在关注的证券的集合(e", ".", "g", ".", ":股票池)。PS:会在下一个bar事件触发时候产生(新的关注的股票池更新)效果。并且update_universe会是覆盖(overwrite)的操作而不是在已有的股票池的基础上进行增量添加。比如已有的股票池为", "[", "000001", ".", "XSHE", "000024", ".", "XSHE", "]", "然后调用了update_universe", "(", "[", "000030", ".", "XSHE", "]", ")", "之后,...
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L327-L340
train
Update the universe of the given id or symbols.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
subscribe
def subscribe(id_or_symbols): """ 订阅合约行情。该操作会导致合约池内合约的增加,从而影响handle_bar中处理bar数据的数量。 需要注意,用户在初次编写策略时候需要首先订阅合约行情,否则handle_bar不会被触发。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] """ current_universe = Environment...
python
def subscribe(id_or_symbols): """ 订阅合约行情。该操作会导致合约池内合约的增加,从而影响handle_bar中处理bar数据的数量。 需要注意,用户在初次编写策略时候需要首先订阅合约行情,否则handle_bar不会被触发。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] """ current_universe = Environment...
[ "def", "subscribe", "(", "id_or_symbols", ")", ":", "current_universe", "=", "Environment", ".", "get_instance", "(", ")", ".", "get_universe", "(", ")", "if", "isinstance", "(", "id_or_symbols", ",", "six", ".", "string_types", ")", ":", "order_book_id", "=",...
订阅合约行情。该操作会导致合约池内合约的增加,从而影响handle_bar中处理bar数据的数量。 需要注意,用户在初次编写策略时候需要首先订阅合约行情,否则handle_bar不会被触发。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`]
[ "订阅合约行情。该操作会导致合约池内合约的增加,从而影响handle_bar中处理bar数据的数量。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L353-L374
train
subscribe to an order_book
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
unsubscribe
def unsubscribe(id_or_symbols): """ 取消订阅合约行情。取消订阅会导致合约池内合约的减少,如果当前合约池中没有任何合约,则策略直接退出。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] """ current_universe = Environment.get_instance().get_universe() if isinstance(...
python
def unsubscribe(id_or_symbols): """ 取消订阅合约行情。取消订阅会导致合约池内合约的减少,如果当前合约池中没有任何合约,则策略直接退出。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] """ current_universe = Environment.get_instance().get_universe() if isinstance(...
[ "def", "unsubscribe", "(", "id_or_symbols", ")", ":", "current_universe", "=", "Environment", ".", "get_instance", "(", ")", ".", "get_universe", "(", ")", "if", "isinstance", "(", "id_or_symbols", ",", "six", ".", "string_types", ")", ":", "order_book_id", "=...
取消订阅合约行情。取消订阅会导致合约池内合约的减少,如果当前合约池中没有任何合约,则策略直接退出。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`]
[ "取消订阅合约行情。取消订阅会导致合约池内合约的减少,如果当前合约池中没有任何合约,则策略直接退出。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L387-L407
train
Unsubscribe from an order_book.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
get_yield_curve
def get_yield_curve(date=None, tenor=None): """ 获取某个国家市场指定日期的收益率曲线水平。 数据为2002年至今的中债国债收益率曲线,来源于中央国债登记结算有限责任公司。 :param date: 查询日期,默认为策略当前日期前一天 :type date: `str` | `date` | `datetime` | `pandas.Timestamp` :param str tenor: 标准期限,'0S' - 隔夜,'1M' - 1个月,'1Y' - 1年,默认为全部期限 :return: `pandas.DataFra...
python
def get_yield_curve(date=None, tenor=None): """ 获取某个国家市场指定日期的收益率曲线水平。 数据为2002年至今的中债国债收益率曲线,来源于中央国债登记结算有限责任公司。 :param date: 查询日期,默认为策略当前日期前一天 :type date: `str` | `date` | `datetime` | `pandas.Timestamp` :param str tenor: 标准期限,'0S' - 隔夜,'1M' - 1个月,'1Y' - 1年,默认为全部期限 :return: `pandas.DataFra...
[ "def", "get_yield_curve", "(", "date", "=", "None", ",", "tenor", "=", "None", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "trading_date", "=", "env", ".", "trading_dt", ".", "date", "(", ")", "yesterday", "=", "env", ".", "data...
获取某个国家市场指定日期的收益率曲线水平。 数据为2002年至今的中债国债收益率曲线,来源于中央国债登记结算有限责任公司。 :param date: 查询日期,默认为策略当前日期前一天 :type date: `str` | `date` | `datetime` | `pandas.Timestamp` :param str tenor: 标准期限,'0S' - 隔夜,'1M' - 1个月,'1Y' - 1年,默认为全部期限 :return: `pandas.DataFrame` - 查询时间段内无风险收益率曲线 :example: .. code-block:...
[ "获取某个国家市场指定日期的收益率曲线水平。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L423-L465
train
get_yield_curve - 获取某个国家市场指定日期的收益率曲线水平
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
history_bars
def history_bars( order_book_id, bar_count, frequency, fields=None, skip_suspended=True, include_now=False, adjust_type="pre", ): """ 获取指定合约的历史行情,同时支持日以及分钟历史数据。不能在init中调用。 注意,该API会自动跳过停牌数据。 日回测获取分钟历史数据:不支持 日回测获取日历史数据 ========================= ========================...
python
def history_bars( order_book_id, bar_count, frequency, fields=None, skip_suspended=True, include_now=False, adjust_type="pre", ): """ 获取指定合约的历史行情,同时支持日以及分钟历史数据。不能在init中调用。 注意,该API会自动跳过停牌数据。 日回测获取分钟历史数据:不支持 日回测获取日历史数据 ========================= ========================...
[ "def", "history_bars", "(", "order_book_id", ",", "bar_count", ",", "frequency", ",", "fields", "=", "None", ",", "skip_suspended", "=", "True", ",", "include_now", "=", "False", ",", "adjust_type", "=", "\"pre\"", ",", ")", ":", "order_book_id", "=", "assur...
获取指定合约的历史行情,同时支持日以及分钟历史数据。不能在init中调用。 注意,该API会自动跳过停牌数据。 日回测获取分钟历史数据:不支持 日回测获取日历史数据 ========================= =================================================== 调用时间 返回数据 ========================= =================================================== T日before_trading ...
[ "获取指定合约的历史行情,同时支持日以及分钟历史数据。不能在init中调用。", "注意,该API会自动跳过停牌数据。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L487-L612
train
A history bar is a sequence of two - dimensional lists.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
all_instruments
def all_instruments(type=None, date=None): """ 获取某个国家市场的所有合约信息。使用者可以通过这一方法很快地对合约信息有一个快速了解,目前仅支持中国市场。 :param str type: 需要查询合约类型,例如:type='CS'代表股票。默认是所有类型 :param date: 查询时间点 :type date: `str` | `datetime` | `date` :return: `pandas DataFrame` 所有合约的基本信息。 其中type参数传入的合约类型和对应的解释如下: =======...
python
def all_instruments(type=None, date=None): """ 获取某个国家市场的所有合约信息。使用者可以通过这一方法很快地对合约信息有一个快速了解,目前仅支持中国市场。 :param str type: 需要查询合约类型,例如:type='CS'代表股票。默认是所有类型 :param date: 查询时间点 :type date: `str` | `datetime` | `date` :return: `pandas DataFrame` 所有合约的基本信息。 其中type参数传入的合约类型和对应的解释如下: =======...
[ "def", "all_instruments", "(", "type", "=", "None", ",", "date", "=", "None", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "if", "date", "is", "None", ":", "dt", "=", "env", ".", "trading_dt", "else", ":", "dt", "=", "pd", "....
获取某个国家市场的所有合约信息。使用者可以通过这一方法很快地对合约信息有一个快速了解,目前仅支持中国市场。 :param str type: 需要查询合约类型,例如:type='CS'代表股票。默认是所有类型 :param date: 查询时间点 :type date: `str` | `datetime` | `date` :return: `pandas DataFrame` 所有合约的基本信息。 其中type参数传入的合约类型和对应的解释如下: ========================= ==================================...
[ "获取某个国家市场的所有合约信息。使用者可以通过这一方法很快地对合约信息有一个快速了解,目前仅支持中国市场。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L630-L707
train
returns all instruments
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/api/api_base.py
current_snapshot
def current_snapshot(id_or_symbol): """ 获得当前市场快照数据。只能在日内交易阶段调用,获取当日调用时点的市场快照数据。 市场快照数据记录了每日从开盘到当前的数据信息,可以理解为一个动态的day bar数据。 在目前分钟回测中,快照数据为当日所有分钟线累积而成,一般情况下,最后一个分钟线获取到的快照数据应当与当日的日线行情保持一致。 需要注意,在实盘模拟中,该函数返回的是调用当时的市场快照情况,所以在同一个handle_bar中不同时点调用可能返回的数据不同。 如果当日截止到调用时候对应股票没有任何成交,那么snapshot中的close, hig...
python
def current_snapshot(id_or_symbol): """ 获得当前市场快照数据。只能在日内交易阶段调用,获取当日调用时点的市场快照数据。 市场快照数据记录了每日从开盘到当前的数据信息,可以理解为一个动态的day bar数据。 在目前分钟回测中,快照数据为当日所有分钟线累积而成,一般情况下,最后一个分钟线获取到的快照数据应当与当日的日线行情保持一致。 需要注意,在实盘模拟中,该函数返回的是调用当时的市场快照情况,所以在同一个handle_bar中不同时点调用可能返回的数据不同。 如果当日截止到调用时候对应股票没有任何成交,那么snapshot中的close, hig...
[ "def", "current_snapshot", "(", "id_or_symbol", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "frequency", "=", "env", ".", "config", ".", "base", ".", "frequency", "order_book_id", "=", "assure_order_book_id", "(", "id_or_symbol", ")", "...
获得当前市场快照数据。只能在日内交易阶段调用,获取当日调用时点的市场快照数据。 市场快照数据记录了每日从开盘到当前的数据信息,可以理解为一个动态的day bar数据。 在目前分钟回测中,快照数据为当日所有分钟线累积而成,一般情况下,最后一个分钟线获取到的快照数据应当与当日的日线行情保持一致。 需要注意,在实盘模拟中,该函数返回的是调用当时的市场快照情况,所以在同一个handle_bar中不同时点调用可能返回的数据不同。 如果当日截止到调用时候对应股票没有任何成交,那么snapshot中的close, high, low, last几个价格水平都将以0表示。 :param str id_or_...
[ "获得当前市场快照数据。只能在日内交易阶段调用,获取当日调用时点的市场快照数据。", "市场快照数据记录了每日从开盘到当前的数据信息,可以理解为一个动态的day", "bar数据。", "在目前分钟回测中,快照数据为当日所有分钟线累积而成,一般情况下,最后一个分钟线获取到的快照数据应当与当日的日线行情保持一致。", "需要注意,在实盘模拟中,该函数返回的是调用当时的市场快照情况,所以在同一个handle_bar中不同时点调用可能返回的数据不同。", "如果当日截止到调用时候对应股票没有任何成交,那么snapshot中的close", "high", "low", "last几个价格水平都将以0...
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/api/api_base.py#L989-L1028
train
Return the current snapshot of the given id or symbol.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/account_model/stock_account.py
StockAccount.dividend_receivable
def dividend_receivable(self): """ [float] 投资组合在分红现金收到账面之前的应收分红部分。具体细节在分红部分 """ return sum(d['quantity'] * d['dividend_per_share'] for d in six.itervalues(self._dividend_receivable))
python
def dividend_receivable(self): """ [float] 投资组合在分红现金收到账面之前的应收分红部分。具体细节在分红部分 """ return sum(d['quantity'] * d['dividend_per_share'] for d in six.itervalues(self._dividend_receivable))
[ "def", "dividend_receivable", "(", "self", ")", ":", "return", "sum", "(", "d", "[", "'quantity'", "]", "*", "d", "[", "'dividend_per_share'", "]", "for", "d", "in", "six", ".", "itervalues", "(", "self", ".", "_dividend_receivable", ")", ")" ]
[float] 投资组合在分红现金收到账面之前的应收分红部分。具体细节在分红部分
[ "[", "float", "]", "投资组合在分红现金收到账面之前的应收分红部分。具体细节在分红部分" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/account_model/stock_account.py#L247-L251
train
get the sum of the dividend receivable
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/interface.py
AbstractDataSource.history_bars
def history_bars(self, instrument, bar_count, frequency, fields, dt, skip_suspended=True, include_now=False, adjust_type='pre', adjust_orig=None): """ 获取历史数据 :param instrument: 合约对象 :type instrument: :class:`~Instrument` :param int bar_count: 获取的历史数据数量 ...
python
def history_bars(self, instrument, bar_count, frequency, fields, dt, skip_suspended=True, include_now=False, adjust_type='pre', adjust_orig=None): """ 获取历史数据 :param instrument: 合约对象 :type instrument: :class:`~Instrument` :param int bar_count: 获取的历史数据数量 ...
[ "def", "history_bars", "(", "self", ",", "instrument", ",", "bar_count", ",", "frequency", ",", "fields", ",", "dt", ",", "skip_suspended", "=", "True", ",", "include_now", "=", "False", ",", "adjust_type", "=", "'pre'", ",", "adjust_orig", "=", "None", ")...
获取历史数据 :param instrument: 合约对象 :type instrument: :class:`~Instrument` :param int bar_count: 获取的历史数据数量 :param str frequency: 周期频率,`1d` 表示日周期, `1m` 表示分钟周期 :param str fields: 返回数据字段 ========================= =================================================== fi...
[ "获取历史数据" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/interface.py#L360-L398
train
This method returns a list of bar_count bar_count_close and bar_count_prev.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_shares
def order_shares(id_or_ins, amount, price=None, style=None): """ 落指定股数的买/卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 ...
python
def order_shares(id_or_ins, amount, price=None, style=None): """ 落指定股数的买/卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 ...
[ "def", "order_shares", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "if", "amount", "==", "0", ":", "# 如果下单量为0,则认为其并没有发单,则直接返回None", "user_system_log", ".", "warn", "(", "_", "(", "u\"Order Creation Failed: O...
落指定股数的买/卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `st...
[ "落指定股数的买", "/", "卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market", "order)。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L68-L139
train
Order shares.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_lots
def order_lots(id_or_ins, amount, price=None, style=None): """ 指定手数发送买/卖单。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 :param float...
python
def order_lots(id_or_ins, amount, price=None, style=None): """ 指定手数发送买/卖单。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 :param float...
[ "def", "order_lots", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "order_book_id", "=", "assure_stock_order_book_id", "(", "id_or_ins", ")", "round_lot", "=", "int", "(", "Environment", ".", "get_instance", ...
指定手数发送买/卖单。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "指定手数发送买", "/", "卖单。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market", "order)。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L162-L194
train
order_lots 取得发送买
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_value
def order_value(id_or_ins, cash_amount, price=None, style=None): """ 使用想要花费的金钱买入/卖出股票,而不是买入/卖出想要的股数,正数代表买入,负数代表卖出。股票的股数总是会被调整成对应的100的倍数(在A中国A股市场1手是100股)。如果资金不足,该API将不会创建发送订单。 需要注意: 当您提交一个买单时,cash_amount 代表的含义是您希望买入股票消耗的金额(包含税费),最终买入的股数不仅和发单的价格有关,还和税费相关的参数设置有关。 当您提交一个卖单时,cash_amount 代表的意义是您希望卖出股票的总价...
python
def order_value(id_or_ins, cash_amount, price=None, style=None): """ 使用想要花费的金钱买入/卖出股票,而不是买入/卖出想要的股数,正数代表买入,负数代表卖出。股票的股数总是会被调整成对应的100的倍数(在A中国A股市场1手是100股)。如果资金不足,该API将不会创建发送订单。 需要注意: 当您提交一个买单时,cash_amount 代表的含义是您希望买入股票消耗的金额(包含税费),最终买入的股数不仅和发单的价格有关,还和税费相关的参数设置有关。 当您提交一个卖单时,cash_amount 代表的意义是您希望卖出股票的总价...
[ "def", "order_value", "(", "id_or_ins", ",", "cash_amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "style", "=", "cal_style", "(", "price", ",", "style", ")", "if", "isinstance", "(", "style", ",", "LimitOrder", ")", ":", "if",...
使用想要花费的金钱买入/卖出股票,而不是买入/卖出想要的股数,正数代表买入,负数代表卖出。股票的股数总是会被调整成对应的100的倍数(在A中国A股市场1手是100股)。如果资金不足,该API将不会创建发送订单。 需要注意: 当您提交一个买单时,cash_amount 代表的含义是您希望买入股票消耗的金额(包含税费),最终买入的股数不仅和发单的价格有关,还和税费相关的参数设置有关。 当您提交一个卖单时,cash_amount 代表的意义是您希望卖出股票的总价值。如果金额超出了您所持有股票的价值,那么您将卖出所有股票。 :param id_or_ins: 下单标的物 :type id_or_i...
[ "使用想要花费的金钱买入", "/", "卖出股票,而不是买入", "/", "卖出想要的股数,正数代表买入,负数代表卖出。股票的股数总是会被调整成对应的100的倍数(在A中国A股市场1手是100股)。如果资金不足,该API将不会创建发送订单。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L206-L282
train
Return order value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_percent
def order_percent(id_or_ins, percent, price=None, style=None): """ 发送一个花费价值等于目前投资组合(市场价值和目前现金的总和)一定百分比现金的买/卖单,正数代表买,负数代表卖。股票的股数总是会被调整成对应的一手的股票数的倍数(1手是100股)。百分比是一个小数,并且小于或等于1(<=100%),0.5表示的是50%.需要注意,如果资金不足,该API将不会创建发送订单。 需要注意: 发送买单时,percent 代表的是期望买入股票消耗的金额(包含税费)占投资组合总权益的比例。 发送卖单时,percent 代表的是期望卖出的股票...
python
def order_percent(id_or_ins, percent, price=None, style=None): """ 发送一个花费价值等于目前投资组合(市场价值和目前现金的总和)一定百分比现金的买/卖单,正数代表买,负数代表卖。股票的股数总是会被调整成对应的一手的股票数的倍数(1手是100股)。百分比是一个小数,并且小于或等于1(<=100%),0.5表示的是50%.需要注意,如果资金不足,该API将不会创建发送订单。 需要注意: 发送买单时,percent 代表的是期望买入股票消耗的金额(包含税费)占投资组合总权益的比例。 发送卖单时,percent 代表的是期望卖出的股票...
[ "def", "order_percent", "(", "id_or_ins", ",", "percent", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "if", "percent", "<", "-", "1", "or", "percent", ">", "1", ":", "raise", "RQInvalidArgument", "(", "_", "(", "u\"percent should betw...
发送一个花费价值等于目前投资组合(市场价值和目前现金的总和)一定百分比现金的买/卖单,正数代表买,负数代表卖。股票的股数总是会被调整成对应的一手的股票数的倍数(1手是100股)。百分比是一个小数,并且小于或等于1(<=100%),0.5表示的是50%.需要注意,如果资金不足,该API将不会创建发送订单。 需要注意: 发送买单时,percent 代表的是期望买入股票消耗的金额(包含税费)占投资组合总权益的比例。 发送卖单时,percent 代表的是期望卖出的股票总价值占投资组合总权益的比例。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~...
[ "发送一个花费价值等于目前投资组合(市场价值和目前现金的总和)一定百分比现金的买", "/", "卖单,正数代表买,负数代表卖。股票的股数总是会被调整成对应的一手的股票数的倍数(1手是100股)。百分比是一个小数,并且小于或等于1(<", "=", "100%),0", ".", "5表示的是50%", ".", "需要注意,如果资金不足,该API将不会创建发送订单。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L294-L326
train
Order a single item in a random order.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_target_value
def order_target_value(id_or_ins, cash_amount, price=None, style=None): """ 买入/卖出并且自动调整该证券的仓位到一个目标价值。 加仓时,cash_amount 代表现有持仓的价值加上即将花费(包含税费)的现金的总价值。 减仓时,cash_amount 代表调整仓位的目标价至。 需要注意,如果资金不足,该API将不会创建发送订单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:c...
python
def order_target_value(id_or_ins, cash_amount, price=None, style=None): """ 买入/卖出并且自动调整该证券的仓位到一个目标价值。 加仓时,cash_amount 代表现有持仓的价值加上即将花费(包含税费)的现金的总价值。 减仓时,cash_amount 代表调整仓位的目标价至。 需要注意,如果资金不足,该API将不会创建发送订单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:c...
[ "def", "order_target_value", "(", "id_or_ins", ",", "cash_amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "order_book_id", "=", "assure_stock_order_book_id", "(", "id_or_ins", ")", "account", "=", "Environment", ".", "get_instance", "(",...
买入/卖出并且自动调整该证券的仓位到一个目标价值。 加仓时,cash_amount 代表现有持仓的价值加上即将花费(包含税费)的现金的总价值。 减仓时,cash_amount 代表调整仓位的目标价至。 需要注意,如果资金不足,该API将不会创建发送订单。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param float cash_amount: 最终的该证券的仓位目标价值。 ...
[ "买入", "/", "卖出并且自动调整该证券的仓位到一个目标价值。", "加仓时,cash_amount", "代表现有持仓的价值加上即将花费(包含税费)的现金的总价值。", "减仓时,cash_amount", "代表调整仓位的目标价至。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L338-L380
train
Get order target value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
order_target_percent
def order_target_percent(id_or_ins, percent, price=None, style=None): """ 买入/卖出证券以自动调整该证券的仓位到占有一个目标价值。 加仓时,percent 代表证券已有持仓的价值加上即将花费的现金(包含税费)的总值占当前投资组合总价值的比例。 减仓时,percent 代表证券将被调整到的目标价至占当前投资组合总价值的比例。 其实我们需要计算一个position_to_adjust (即应该调整的仓位) `position_to_adjust = target_position - current_posit...
python
def order_target_percent(id_or_ins, percent, price=None, style=None): """ 买入/卖出证券以自动调整该证券的仓位到占有一个目标价值。 加仓时,percent 代表证券已有持仓的价值加上即将花费的现金(包含税费)的总值占当前投资组合总价值的比例。 减仓时,percent 代表证券将被调整到的目标价至占当前投资组合总价值的比例。 其实我们需要计算一个position_to_adjust (即应该调整的仓位) `position_to_adjust = target_position - current_posit...
[ "def", "order_target_percent", "(", "id_or_ins", ",", "percent", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "if", "percent", "<", "0", "or", "percent", ">", "1", ":", "raise", "RQInvalidArgument", "(", "_", "(", "u\"percent should betw...
买入/卖出证券以自动调整该证券的仓位到占有一个目标价值。 加仓时,percent 代表证券已有持仓的价值加上即将花费的现金(包含税费)的总值占当前投资组合总价值的比例。 减仓时,percent 代表证券将被调整到的目标价至占当前投资组合总价值的比例。 其实我们需要计算一个position_to_adjust (即应该调整的仓位) `position_to_adjust = target_position - current_position` 投资组合价值等于所有已有仓位的价值和剩余现金的总和。买/卖单会被下舍入一手股数(A股是100的倍数)的倍数。目标百分比应该是一个小数,并且最大值...
[ "买入", "/", "卖出证券以自动调整该证券的仓位到占有一个目标价值。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L392-L445
train
Order a single target by a given percentage.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
is_suspended
def is_suspended(order_book_id, count=1): """ 判断某只股票是否全天停牌。 :param str order_book_id: 某只股票的代码或股票代码,可传入单只股票的order_book_id, symbol :param int count: 回溯获取的数据个数。默认为当前能够获取到的最近的数据 :return: count为1时 `bool`; count>1时 `pandas.DataFrame` """ dt = Environment.get_instance().calendar_dt.date() or...
python
def is_suspended(order_book_id, count=1): """ 判断某只股票是否全天停牌。 :param str order_book_id: 某只股票的代码或股票代码,可传入单只股票的order_book_id, symbol :param int count: 回溯获取的数据个数。默认为当前能够获取到的最近的数据 :return: count为1时 `bool`; count>1时 `pandas.DataFrame` """ dt = Environment.get_instance().calendar_dt.date() or...
[ "def", "is_suspended", "(", "order_book_id", ",", "count", "=", "1", ")", ":", "dt", "=", "Environment", ".", "get_instance", "(", ")", ".", "calendar_dt", ".", "date", "(", ")", "order_book_id", "=", "assure_stock_order_book_id", "(", "order_book_id", ")", ...
判断某只股票是否全天停牌。 :param str order_book_id: 某只股票的代码或股票代码,可传入单只股票的order_book_id, symbol :param int count: 回溯获取的数据个数。默认为当前能够获取到的最近的数据 :return: count为1时 `bool`; count>1时 `pandas.DataFrame`
[ "判断某只股票是否全天停牌。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L457-L469
train
is_suspended 判断某只股票是否全天停牌。
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/__main__.py
update_bundle
def update_bundle(data_bundle_path, locale): """ Sync Data Bundle """ import rqalpha.utils.bundle_helper rqalpha.utils.bundle_helper.update_bundle(data_bundle_path, locale)
python
def update_bundle(data_bundle_path, locale): """ Sync Data Bundle """ import rqalpha.utils.bundle_helper rqalpha.utils.bundle_helper.update_bundle(data_bundle_path, locale)
[ "def", "update_bundle", "(", "data_bundle_path", ",", "locale", ")", ":", "import", "rqalpha", ".", "utils", ".", "bundle_helper", "rqalpha", ".", "utils", ".", "bundle_helper", ".", "update_bundle", "(", "data_bundle_path", ",", "locale", ")" ]
Sync Data Bundle
[ "Sync", "Data", "Bundle" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L77-L82
train
Update the data bundle with the given locale.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/__main__.py
run
def run(**kwargs): """ Start to run a strategy """ config_path = kwargs.get('config_path', None) if config_path is not None: config_path = os.path.abspath(config_path) kwargs.pop('config_path') if not kwargs.get('base__securities', None): kwargs.pop('base__securities', No...
python
def run(**kwargs): """ Start to run a strategy """ config_path = kwargs.get('config_path', None) if config_path is not None: config_path = os.path.abspath(config_path) kwargs.pop('config_path') if not kwargs.get('base__securities', None): kwargs.pop('base__securities', No...
[ "def", "run", "(", "*", "*", "kwargs", ")", ":", "config_path", "=", "kwargs", ".", "get", "(", "'config_path'", ",", "None", ")", "if", "config_path", "is", "not", "None", ":", "config_path", "=", "os", ".", "path", ".", "abspath", "(", "config_path",...
Start to run a strategy
[ "Start", "to", "run", "a", "strategy" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L112-L140
train
Runs a strategy
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/__main__.py
examples
def examples(directory): """ Generate example strategies to target folder """ source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "examples") try: shutil.copytree(source_dir, os.path.join(directory, "examples")) except OSError as e: if e.errno == errno.EEXIST:...
python
def examples(directory): """ Generate example strategies to target folder """ source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "examples") try: shutil.copytree(source_dir, os.path.join(directory, "examples")) except OSError as e: if e.errno == errno.EEXIST:...
[ "def", "examples", "(", "directory", ")", ":", "source_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "\"examples\"", ")", "try", ":", "shu...
Generate example strategies to target folder
[ "Generate", "example", "strategies", "to", "target", "folder" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L145-L155
train
Generate example strategies to target folder
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ricequant/rqalpha
rqalpha/__main__.py
generate_config
def generate_config(directory): """ Generate default config file """ default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml") target_config_path = os.path.abspath(os.path.join(directory, 'config.yml')) shutil.copy(default_config, target_config_path) six.print_...
python
def generate_config(directory): """ Generate default config file """ default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml") target_config_path = os.path.abspath(os.path.join(directory, 'config.yml')) shutil.copy(default_config, target_config_path) six.print_...
[ "def", "generate_config", "(", "directory", ")", ":", "default_config", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "\"config.yml\"", ")", "target...
Generate default config file
[ "Generate", "default", "config", "file" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L170-L177
train
Generate default config file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...