Skip to content

Latest commit

 

History

History
85 lines (72 loc) · 2.16 KB

utility.org

File metadata and controls

85 lines (72 loc) · 2.16 KB

Graphic Strategist

FS 拓扑

  • Function Define, Function Define + Parameters -> Function Instance.

把FD绑定参数之后生成FI.

  • Function Define -> Function Sampling.

FS由FD搭建。

  • Function Sampling Define, Function Sampling Instance.

也可以通过把FSD绑定参数,产生FSI。

  • Function Queue, Function Queue Instance.

当FS跑出大量FSI之后,需要设置筛选条件来取出符合要求的FSI,这个时候需要设定FQ,同时通过FQI来取目标FSI。

单因子流程

文档

股票因子

股票策略

函数采样

函数定义

utilities

guide

export file

!cp /home/gft/data/x0.pkl ~/work/

gftIO.zdump(data, '/home/gft/data/file_name.zpkl')

transfer:

  • transfer column table to matrix
result.pivot(index='date',columns='variable',values='value')
  • b char array to GID
import pickle, zlib
# b char array to Chinese
def transformDictWithMap(dic, namemap):
    resultDict = dict()
    for key, value in dic.items():
        try:
            resultDict[key] = transformData4Name(value, namemap)
        except Exception:
            print("transform " + key + ' failed')
            return
    return resultDict


def transformDict4Name(dic):
    with open("/home/gft/work/lib/gftTools/symbols.pkl", "rb") as fpz:
        value = fpz.read()
        namemap = pickle.loads(value)
    return transformData4Name(dic, namemap)

# b char array to 32 bit hex
def intTuple2Str(tup2Int):
    """
    convert tuple to 32bit hex
    """
    str1 = int.to_bytes(int(tup2Int[0][0]), 8, "big").hex()
    str2 = int.to_bytes(int(tup2Int[0][1]), 8, "big").hex()
    return str1+str2


def oSet2Hex(oSet):
    """
    convert array to 32 bit hex array
    """
    ret = oSet.astype(oDataType)
    return np.apply_along_axis(intTuple2Str, 1, ret.reshape(-1, 1))

transformDict4Name(x10.asMatrix())
  • transfer b char array to GID.
# coding: utf-8
gftIO.gidInt2Str(b'&90\r@r\xb1Y\x02\x00\x00\x7f\x00\x00\x00\xe1')

show files:

! ls /home/gft/work/lib/gftTools/
! echo $PYTHONPATH