精华内容
下载资源
问答
  • The volatility index and style rotation Evidence from the Korean stock market and VKOSP
  • all the orthers like forex, smartfx, commodities work but if i go to volatility index, it changes instantly to smartfx. <p>Is anyone experiencing the same problems? My servers are in US because its ...
  • Relaxation dynamics of aftershocks after large volatility shocks in the SSEC index,牟国华,周炜星,The relaxation dynamics of aftershocks after large volatility shocks are investigated based on two ...
  • I think it is better that we deliver a volatility index from the provider nodes and based on that we set the buyers deposit. The volatility can be measured by the price nodes as they get the prices ...
  • t see any changes in the elasticsearch index. Timesketch says: Indexing in progress... . Each element has a field "process_mem_strings" that contains the output of the strings command of a ...
  • 但是Python是可以用来编写大型的项目的,比如: Volatility:https://code.google.com/p/volatility/ Cuckoo:http://cuckoosandbox.org/index.html 1. ctypes库 http://docs.python.org/2/lib...

    之前使用python都是用来做一些简单的脚本,本质上和bat批处理文件没有区别。

    但是Python是可以用来编写大型的项目的,比如:

    Volatility:https://code.google.com/p/volatility/

    Cuckoo:http://cuckoosandbox.org/index.html

     

    1. ctypes库

    http://docs.python.org/2/library/ctypes.html

    Python被称为一种“胶水语言(http://en.wikipedia.org/wiki/Glue_language#Glue_languages)”,是因为它可以很方便地与其他语言,比如C语言进行协作。

    另外,Windows操作系统的API基本上都是由DLL库提供的,Python如果需要使用Windows API,就需要能够与DLL进行协作。

     

    ctypes就是解决这两种需要的库。

    ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.

    >>> import ctypes
    >>> print ctypes.windll.kernel32
    <WinDLL 'kernel32', handle 77090000 at 29eb208>
    >>> 

    我们到Process Hacker中查看IDLE进程的module列表:

    kernel32.dll, 0x77090000, 1.12 MB, Windows NT BASE API Client DLL

    “print ctypes.windll.kernel32”是如何打印出来的?

    class CDLL(object):
        def __repr__(self):
                return "<%s '%s', handle %x at %x>" % \
                       (self.__class__.__name__, self._name,
                        (self._handle & (_sys.maxint*2 + 1)),
                        id(self) & (_sys.maxint*2 + 1))
        

    id(self)代表的是object的地址,而self._handle是ctypes.windll.kernel32的成员变量,代表的是这个模块的基地址,具体是由下面的代码初始化的

    class CDLL(object):
        def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                         use_errno=False,
                         use_last_error=False):
        ......
        
                if handle is None:
                    self._handle = _dlopen(self._name, mode)
                else:
                    self._handle = handle

    当程序访问windll的kernel32成员变量时,如果该变量还没有被定义,那么会调用__getattr__元函数来定义这个变量:

    class LibraryLoader(object):
        def __init__(self, dlltype):
            self._dlltype = dlltype
     
        def __getattr__(self, name):
            if name[0] == '_':
                raise AttributeError(name)
            dll = self._dlltype(name)
            setattr(self, name, dll)
            return dll
     
        def __getitem__(self, name):
            return getattr(self, name)
     
        def LoadLibrary(self, name):
            return self._dlltype(name)

    而windll正好是一个LibraryLoader的object,它的构造函数的参数为WinDLL类对象,WinDLL继承自CDLL

    if _os.name in ("nt", "ce"):
        windll = LibraryLoader(WinDLL)
        oledll = LibraryLoader(OleDLL)

    重新理顺一下,windll实际上是一个WinDLL(该类继承自CDLL)类的对象,kernel32是该对象动态生成(通过元函数__getattr__)的一个成员变量,在kernel32成员变量初始化的过程中,会调用_dlopen打开相应的module,并且将module的基地址(即handle)赋值给kernel32._handle成员变量。

     

    这个过程,可以看出Python是一种很灵活,而且很“面向对象”的语言。而个人的经验是,对于这样的一种语言,高层次的设计就显得尤为重要,而设计模式的地位也就是凸显出来了。

     

    2. Python的数据模型

    参考:http://docs.python.org/2/reference/datamodel.html

    Every object has an identity, a type and a value. An object’s identity never changes once it has been created; you may think of it as the object’s address in memory. The ‘is‘ operator compares the identity of two objects; the id() function returns an integer representing its identity (currently implemented as its address). An object’s type is also unchangeable. [1] An object’s type determines the operations that the object supports (e.g., “does it have a length?”) and also defines the possible values for objects of that type. The type() function returns an object’s type (which is an object itself). The value of some objects can change. Objects whose value can change are said to be mutable; objects whose value is unchangeable once they are created are called immutable. (The value of an immutable container object that contains a reference to a mutable object can change when the latter’s value is changed; however the container is still considered immutable, because the collection of objects it contains cannot be changed. So, immutability is not strictly the same as having an unchangeable value, it is more subtle.) An object’s mutability is determined by its type; for instance, numbers, strings and tuples are immutable, while dictionaries and lists are mutable.

    这段话很重要,简单翻译如下:

    每个Python的对象都有一个身份,一个类型以及一个

    1. 身份:【身份可以用来区分两个对象是否相同】

    一个Python对象一旦被创建了,它的身份就不会再发生改变;它的身份可以用对象在内存中的存储地址来表示。is操作符可以用来对比两个对象的身份是否相同;而id函数会返回代表一个对象的身份的内存地址,以一个整数的形式作为返回值。

    2. 类型:【代表着所有同类对象的抽象特征】

    一个Python对象的类型也是不可以改变的,类型决定了这个对象支持哪些操作,以及这个对象可能拥有什么样类型的数据。type函数可以返回一个对象的类型,返回值也是一个对象,用来代表类型的抽象信息。

    3. 值:【就是这个对象承载的有效信息负荷】

    一个Python对象的值是可以变化的,当然也可以保持不变。我们使用mutable/immutable来区分一个Python对象的值是不是保持不变。

    一个Python对象的值是否可变(它的mutability),是由这个对象的类型决定的。

    比如:numbers, strings, tuples都是值不可变的类型(immutable),而dictionaries, list都是值可变的类型(mutable)。

    3. Python的特殊成员函数

    Python定义了一些特殊的成员函数,用户自定义的类型可以覆盖这些特殊函数的默认实现。

    3.1 __new__与__init__

    参考:http://stackoverflow.com/questions/674304/pythons-use-of-new-and-init

    http://bbs.csdn.net/topics/340028226

    __new__() is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation. It is also commonly overridden in custom metaclasses in order to customize class creation.

    __new__的调用时机比__init__早,__new__主要是用来个性化地定制那些值不可以改变的内置类型的子类型的实例化过程。这是为什么呢?

    前面我们说到,有些内置类型是immutable的,就是说它们一旦被赋值,就无法再改变,那么它们是在哪里被赋值呢,是在__new__中,还是在__init__中呢?

    import os,sys
     
    class square_of(float):
        def __new__(cls, val):
            print "invoked __new__(%s, %f)" % ( cls.__name__,val)
            return float.__new__(cls, val*val)
     
        def __init__(self, val):
            print "invoked __init__(%s, %f)" % ( self.__class__.__name__,self)
            float.__init__(self, val*val)
     
    a = square_of(2.2)
    print a
    >>> ================================ RESTART ================================
    >>> 
    invoked __new__(square_of, 2.200000)
    invoked __init__(square_of, 4.840000)
    4.84
    >>> 

    很明显,是在float.__new__中赋值的,等到了__init__时,木已成舟,一切都晚了。

    至于为什么提供__new__呢,如果我们想要自己定义一种新的Immutable的数据类型,要怎么办呢?

    http://en.wikipedia.org/wiki/Immutable_object#Python给出的方案如下:

    class Immutable(object):
         """An immutable class with a single attribute 'value'."""
         def __setattr__(self, *args):
             raise TypeError("can't modify immutable instance")
         __delattr__ = __setattr__
         def __init__(self, value):
             # we can no longer use self.value = value to store the instance data
             # so we must explicitly call the superclass
             super(Immutable, self).__setattr__('value', value)
    但是,这并不是一个严格的Immutable的实现,因为数据是存放在父类object类中的,而object本身并不是Immutable的,所以这个实现就是一个伪实现,
    class Immutable(object):
        """An immutable class with a single attribute 'value'."""
        def __setattr__(self, *args):
            raise TypeError("can't modify immutable instance")
        __delattr__ = __setattr__
        def __init__(self, value):
            # we can no longer use self.value = value to store the instance data
            # so we must explicitly call the superclass
            super(Immutable, self).__setattr__('value', value)
     
    b = Immutable(2.2)
    super(Immutable, b).__setattr__('value', 4.4)
    print b.value
    >>> ================================ RESTART ================================
    >>> 
    4.4
    >>> 

    因为接口并没有被封死。

    那么应该如何实现自定义的Immutable类型呢,答案是用内置的Immutable类型来派生新的Immutable类型。


    __new__可以创建一个与cls不相同的类型的对象,然后返回,虽然它是被要求返回cls类型的对象的。

    如果__new__创建的是与cls相同类型的对象,那么会调用__init__函数;否则,不会调用__init__函数。

    3.2 __del__

    与__init__是相对的,二者就类似于构造和析构函数。

     

    3.3 __repr__和__str__

    可以理解为__repr__是为了Python内部对象交换使用的,比如Serialization;而__str__主要是为了print打印的,以方便阅读为前提。

     

    3.4 __getattr__, __setattr__和__delattr__

    主要是对于attribute的访问接口

    object.attribute

     

    3.5 __getitem__, __setitem__和__delitem__

    主要是访问字典的接口

    self[key]

    转载于:https://www.cnblogs.com/long123king/p/3598383.html

    展开全文
  • 参考文章:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile https://www.ibm.com/developerworks/library/j-jtp06197/index.html https://tutorials.jenkov.com/ja...

    参考文章:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile

                   https://www.ibm.com/developerworks/library/j-jtp06197/index.html

                   https://tutorials.jenkov.com/java-concurrency/volatile.html

    1、atomicity(原子操作):一个操作不中断,一直执行完

                                  对成员变量进行操作。

        volatile:就是在原子操作下,保证变量的visible。

    2、按照:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile

      编译和运行时:

        1>禁止分配它们到寄存器(registers),保证一个线程写后能马上更新到内存,所有线程都能看见,

        2>必须保证volatile变量读之前缓冲区(cpu cache)无效,哪么线程只能在内存读。

    class VolatileExample {
      int x = 0;
      volatile boolean v = false;
      public void writer() {
        x = 42;
        v = true;
      }
    
      public void reader() {
        if (v == true) {
          //uses x - guaranteed to see 42.
        }
      }
    }
         1>如果v不是volatile变量,哪么reader()读操作,当v==true,有可能读到x=0。

             原因:有可能编译器重新排序 v=true,x=42,哪么读出的是未改变的值。

              所以:编译器看见有volatile变量存在的地方,有cpu缓存,但是读时不让去缓冲读,直接从内存读,不重新排序。


    一、功能介绍

    1、atomicity :原子操作,也叫lock-free 无锁,即不需要锁操作。

        优点:操作不能被thread 调度者中断,一气呵成,比如:正在高考数学,考完才出来吧!

       atomicity :对应单cpu ,在多cpu用 visibility代替。

    2、比较

    synchronized:不能保证共享变量前的所有变量数据(非共享数据)一定会存入内存。
       如果是共享数据,哪么感觉两个线程基本上会看见新值。
    因为这syn对象锁保证只有单独一个线程读数据后,保存到内存,下一个线程才能读,这是syn对象锁的基本功能。
    atomicity,volatile:
      编译器或jvm不能重新排序volatil 指令的执行顺序。  
    特殊情况有可能如下:
    一个synchronized 线程改变成员变量值后
      1》首先应该写入到缓冲中,如果当前干活线程改变值后,值存放在缓中,未向内存写。
      2》这时手动删除本window7的缓存,
     3》下一个线程执行的话,去内存取,还是以前的值,所以刚刚改的值根本未入内存
      感觉只有这种情况下才会出错,一般应该没问题。
    1>一个线程写入变量后,马上入内存。
    2>多个线程读,直接去内存读,所以这种情况数据不存在一致性问题。
    但是,如果一个线程写入变量到cache后,未入内存,刚好另一个线程从内存读,又出现一致性问题了。

      目前默认原子操作的变量:primtive types(int,char,byte):原子操作,读、写只需要一条指令即可。

                       1》返回值 return i;这是一个原子操作。          

    3、  volatility:对syn对象锁的补充。

          a long or double:是64位,一次读,非原子操作,需要分成两个32位来操作,对应两条指令,两条指令中间可以插入其它指令。        

       (1) 设置成员变量:非volatility 

               当对一个线程对成员变量进行的an atomic 操作时,就我一个干活线程用,别的干活线程不用,哪么也不需要刷新main memory了(主要目的让别的线程看见新改的值)

      (2)设置成员变量:volatility (有波动的意思)

             1>实时更新数据

                多个干活线程访问同一个成员变量时,必须设置成volatility ,当一个线程改了成员变量值,哪么所有用到这个成员变量的干活线程必须能看见新改的值。

             2>volatility  可以让一个long 变量成为原子操作?未测试

               本来一个64位的 long是非原子操作。

    二、例子:  一看,感觉下面两个方法对成员变量i是原子操作 

                       但是指令“get” 和 "put" 之间,另一个对象也可以修改成员变量的值,所以下面操作非原子。

              Atomicity 类,可以new Atomicity(),生成多个对象,并且多个对象都可以操作f1(),f2()方法,有可能存在先执行,同时执行等待的可能。

    package concurrency;
    public class Atomicity {                   
    int i;
    void f1() {
    i++;
    }
    void f2() {
    i += 3;
    }
    }
    反编译:
      void f1();
      Code:
    0: aload_0
    1: dup
    2: getfield #2; //取得成员变量i
    5: iconst_1
    6: iadd
    7: putfield #2; //保存成员变量i
    10: return
    void f2();
    Code:
    0: aload_0
    1: dup
    2: getfield #2; //Field i:I
    5: iconst_3
    6: iadd
    7: putfield #2; //Field i:I
    10: return


    三、不要盲目使用原子的思想

       下面例子本想取一个偶数值,但是由于getValue 以为是原子操作,没有设置对象锁。

         因此当evenIncrement 执行到一个i++后(奇数)------getValue 取值,出现错误。

         1、成员变量 i

          2、方法getValue(只有返回值),是一个原子操作

          3、方法 evenIncrement 带有对象锁  自增1,两次,

          4、干活线程AtomicityTest,

         

    package concurrency;
    import java.util.concurrent.*;
    public class AtomicityTest implements Runnable {
    private int i = 0;
    public  int  getValue() {
    return i;
    }
    private synchronized void evenIncrement() {
    i++;
    i++;
    }
    public void run() {
    System.out.println("run 开始!");
    while (true)
    evenIncrement();
    }
    public static void main(String[] args) {
    ExecutorService exec = Executors.newCachedThreadPool();
    AtomicityTest at = new AtomicityTest();
    exec.execute(at);
    System.out.println("main!");
    while (true) {
    System.out.println("main 循环开始!");
    int val = at.getValue();
    System.out.println("val ="+val);
    if (val % 2 != 0) {
    System.out.println(val);
    System.exit(0);
    }
    }
    }
    }


    参考文章:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile



    展开全文
  • <p>The vocabulary does not have this index: <pre><code> [INFO:sockeye.vocab] Vocabulary (7525 words) loaded from "/...
  • vix 计算方法

    2018-08-14 15:55:14
    The CBOE Volatility Index - VIX The powerful and flexible trading and risk management tool from the Chicago Board Options Exchange
  • """ perf.columns的结果为: ... Index(['Unnamed: 0', 'algo_volatility', 'algorithm_period_return', 'alpha', 'benchmark_period_return', 'benchmark_volatility', 'beta', 'capital_used', 'en...
    """
        perf.columns的结果为:
    
        Index(['Unnamed: 0', 'algo_volatility', 'algorithm_period_return', 'alpha',
           'benchmark_period_return', 'benchmark_volatility', 'beta',
           'capital_used', 'ending_cash', 'ending_exposure', 'ending_value',
           'excess_return', 'gross_leverage', 'information', 'long_exposure',
           'long_value', 'longs_count', 'max_drawdown', 'max_leverage',
           'net_leverage', 'orders', 'own_current_position_amount',
           'own_current_signal', 'own_long_average_value', 'own_price',
           'own_price_percentage', 'own_short_average_value', 'period_close',
           'period_label', 'period_open', 'pnl', 'portfolio_value', 'positions',
           'returns', 'sharpe', 'short_exposure', 'short_value', 'shorts_count',
           'sortino', 'starting_cash', 'starting_exposure', 'starting_value',
           'trading_days', 'transactions', 'treasury_period_return'],
          dtype='object')
    """
    
    perf = pd.read_csv("btc_day.csv", parse_dates=True,) #type:pd.DataFrame
    
    perf.rename(columns={"Unnamed: 0":"datetime"},inplace=True)

    参考官方文档:https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename

     

    参考别人的:https://www.jianshu.com/p/9c904cec61f6

    展开全文
  • <div><p>Hello guys, i installed cuckoo to virtual Kali Linux and i am trying to analyze a malware to a virtual windows 7 unsuccessfully. on the cuckoo logs i am getting the following error ...
  • Help with renderer exception

    2020-12-27 14:39:39
    <p>I and are trying to run some volatility plugins with dask and obtain from any of them a json with the rendered output. To do so we've created a custom rendered 99% inspired from cli.text_...
  • 计算中国etf股票期权的实时vix波指的模块(根据CBOE Volatility Index算法) 可以连接实时期权行情数据,实现秒级vix更新 基于python语言 如有问题联系: 1336838217@qq.com
  • Kim, H. Y. , & Won, C.... Forecasting the volatility of stock price index: A hy- brid model integrating LSTM with multiple GARCH-type models. Expert Systems with Applications, 103 , 25–37 .
  • Best time to trade?

    2020-12-09 02:17:11
    <div><p>Can anyone say what is best time to trade volatility 100 index?</p><p>该提问来源于开源项目:binary-com/binary-bot</p></div>
  • <div><p>please help this strategy its about barrier volatilyty index 10 ...analize last 5 sex volatility index 10 value</p><p>该提问来源于开源项目:binary-com/binary-bot</p></div>
  • Morgan Rothschild Academy Many economic Morgan Rothschild Academy scholars believe that China's stock market volatility is too large, the stock index can not be a true reflection of the development of...
    Morgan Rothschild Academy Many economic Morgan Rothschild Academy scholars believe that China's stock market volatility is too large, the stock index can not be a true reflection of the development of the economy, even the stock market away from the real economy. Empirical test by sub-period data, some economists said the existence of a long-term relationship between the stock market and the economy. So this will be Morgan Rothschild Academycombined with new economic data, the empirical analysis methods to test the long-term relationship of stock price index and GDP.ce of empirical research methods Cointegration is Morgan Rothschild Academy a long-run equilibrium relationship between the statistical description of non-stationary economic variables. Long-term stable equilibrium relationship called cointegration relationship between non-stationary economic variables. So first to Morgan Rothschild Academy test whether a variable is non-stationary variables, we introduce unit root test methods for non-stationary variable DF and ADF test.ADF statistic distribution characteristics:The prevalence of self-regression model: Where Morgan Rothschild Academym is the displacement items, the trend items. Set = 0 satisfy weak conditions that allowed temporary autocorrelation and heteroscedasticity century economic time series so easier to satisfy this condition. Obviously, for these three models, when threshold, then the non-stationary; df
    展开全文
  • Suggestion: Default Market

    2020-12-08 23:10:22
    Today is AUD Index, the suggestion is to be Volatility Index 100. <p><img alt="image" src="https://img-blog.csdnimg.cn/img_convert/cbccd97a79c371e7cfe78b05db0de8e4.png" /></p><p>该提问来源于开源项目...
  • <div><p>Hello guys! Im trying to make a bot that after any last digit that ... (Volatility 50 Index, Matches/Differs, Duration 1 ticks.) </p><p>该提问来源于开源项目:binary-com/binary-bot</p></div>
  • - 根据[White Paper Cboe Volatility Index](http://www.cboe.com/micro/vix/vixwhite.pdf) - 数据格式为bson/json(适用mongodb数据库)。可以提供分钟级别数据,如果需要excel/csv或其他格式、或需要更多历史和...
  • - 根据[White Paper Cboe Volatility Index](http://www.cboe.com/micro/vix/vixwhite.pdf) - 数据格式为exce/bson/json(适用mongodb数据库)。可以提供分钟级别数据,如果需要excel/csv或其他格式、或需要更多...
  • Add sell option to bot

    2020-12-09 02:16:51
    When we place a call or put Oder in volatility index (think we put 10$ call Oder) in long time(30 minute). If it exceed we expected profit (think i need 2$ profit on that trade) trade auto close and ...
  • ie: the same LDP every 2 seconds for everyone playing that Volatility index at that time? OR does the index change for whoever is individually playing based stake etc? <p>I see many Youtube videos of ...
  • adding cpi token

    2020-12-26 13:05:57
    <div><p>Project team ...https://markets.businessinsider.com/news/stocks/crypto-price-index-to-solve-for-rampant-crypto-market-volatility-with-token-tied-to-most-comprehensive-market-index-1028739958 ...
  • <p>What I saw on binary.com is forex, volatility index, etc <p>Please how can I find binary options? It usually has a 'call or put' or 'buy and sell' trade option</p><p>该提问来源于...
  • Out of sample forecast

    2020-12-28 13:40:50
    2) Given the parameters, initialise the volatility calculation with either the sample variance of first T observation or w/(1-a-b) and compute volatility from time 1 to T 3) obtain volatility forecast...
  • <ul><li>Volatility Index 100</li><li>Digit Over </li><li>Last Digit '0'</li><li>5 ticks Indicators will be:</li><li>Amaud Legous Moving Average</li><li>Donchain Channel</li></ul> <p>The bot ...
  • Tengo un bot para Bnary en VOLATILITY INDEX que ejecuta operación a un minuto en apertura de vela, 00 ó 59 segundos, sea para put o call; desde hace 6 días el bot ejecuta operativa en 58 ó 57 ó ...
  • Need to add all the values

    2020-12-08 23:16:43
    Like in Volatility index 50 current price is 400.6789 So I need to read how many digits are there first, here its total 7. Then I want to add all the values. 4+0+0+6+7+8+9 &#...
  • Bought: Win payout if the last digit of Volatility 100 Index is" and the Previous least frequent LD, for some reason?! Please help </p><p>该提问来源于开源项目:binary-...

空空如也

空空如也

1 2 3
收藏数 57
精华内容 22
关键字:

indexvolatility