/* Generated by Cython 0.29.23 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "language": "c++",
        "name": "trapeza.strategy.fx_strategy",
        "sources": [
            "trapeza/strategy/fx_strategy.pyx"
        ]
    },
    "module_name": "trapeza.strategy.fx_strategy"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_23"
#define CYTHON_HEX_VERSION 0x001D17F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__trapeza__strategy__fx_strategy
#define __PYX_HAVE_API__trapeza__strategy__fx_strategy
/* Early includes */
#include <string.h>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <string>
#include <utility>

    #if __cplusplus > 199711L
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include <unordered_map>
#include <vector>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "trapeza\\strategy\\fx_strategy.pyx",
  "trapeza\\strategy\\fx_strategy.pxd",
  "stringsource",
};

/*--- Type declarations ---*/
struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy;

/* "trapeza/arithmetics/arithmetics.pxd":1
 * ctypedef double (*c_precision_t)(double, double)             # <<<<<<<<<<<<<<
 * cdef c_precision_t c_precision_add
 * cdef c_precision_t c_precision_subtract
 */
typedef double (*__pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t)(double, double);

/* "trapeza/strategy/fx_strategy.pxd":12
 * 
 * # noinspection PyPep8Naming
 * cdef class cFXStrategy:             # <<<<<<<<<<<<<<
 *     cdef vector[vector[vector[string]]] c_signals
 *     cdef unordered_map[string, vector[vector[double]]] c_positions
 */
struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy {
  PyObject_HEAD
  struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_vtab;
  std::vector<std::vector<std::vector<std::string> > >  c_signals;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  c_positions;
  std::unordered_map<std::string,std::vector<double> >  c_merged_positions;
  std::vector<std::vector<double> >  c_total_balances;
  std::vector<double>  c_merged_total_balances;
  std::unordered_map<long,std::vector<std::string> >  _c_signals_at_step_t;
  std::string c_name;
  bool _c_ignore_type_checking;
  PyObject *c_accounts;
  long c_lookback;
  bool c_suppress_ticking;
  PyObject *c_strategy_kwargs;
  PyObject *c_tick_kwargs;
  PyObject *c_strategy_func;
  PyObject *c_tick_method;
  PyObject *_c_init_accs_depots;
  PyObject *_c_accs_clocks;
};



/* "trapeza/strategy/fx_strategy.pyx":43
 * 
 * # noinspection PyUnresolvedReferences,PyPep8Naming,PyAttributeOutsideInit,PyProtectedMember,PyTypeChecker
 * cdef class cFXStrategy:             # <<<<<<<<<<<<<<
 *     """
 *     This as a C++ implementation via cython and gets wrapped by FXStrategy class. This class tries to stay in C++ space
 */

struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy {
  short (*c_init)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::string, PyObject *, PyObject *, long, PyObject *, bool, bool, PyObject *, PyObject *, int __pyx_skip_dispatch);
  short (*_c_init_all_positions)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*_c_reset_storage)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  short (*c_reset)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*parse_positions)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::unordered_map<std::string,std::vector<std::vector<double> > > );
  PyObject *(*parse_signals)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<std::vector<std::vector<std::string> > > );
  PyObject *(*parse_merged_positions)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::unordered_map<std::string,std::vector<double> > );
  PyObject *(*parse_total_balances)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<std::vector<double> > );
  PyObject *(*parse_merged_total_balances)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<double> );
  PyObject *(*self_parse_positions)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*self_parse_signals)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*self_parse_merged_positions)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*self_parse_total_balances)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*self_parse_merged_total_balances)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  PyObject *(*self_parse_signals_at_step_t)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch);
  short (*positions_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*signals_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*merged_positions_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*total_balances_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*merged_total_balances_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  short (*_signals_at_step_t_from_py)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*c_wrap_evaluate)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, int __pyx_skip_dispatch);
  short (*c_evaluate)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, bool, std::vector<std::vector<std::string> >  *, std::vector<std::unordered_map<std::string,double> >  *, std::vector<double>  *);
  short (*c_add_signal)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, long, std::string, int __pyx_skip_dispatch);
  short (*c_run)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, long, std::vector<std::vector<std::vector<std::string> > >  *, std::unordered_map<std::string,std::vector<std::vector<double> > >  *, std::unordered_map<std::string,std::vector<double> >  *, std::vector<std::vector<double> >  *, std::vector<double>  *);
  PyObject *(*c_wrap_run)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, long, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_vtabptr_7trapeza_8strategy_11fx_strategy_cFXStrategy;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* set_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set);
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set);

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* IncludeCppStringH.proto */
#include <string>

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* decode_cpp_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string(
         std::string cppstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    return __Pyx_decode_c_bytes(
        cppstring.data(), cppstring.size(), start, stop, encoding, errors, decode_func);
}

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
#define __Pyx_PyCallable_Check(obj)   ((obj)->ob_type->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchInspect.proto */
static PyObject* __Pyx_patch_inspect(PyObject* module);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CyFunctionClassCell.proto */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* None.proto */
#include <new>

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);

/* CIntFromPy.proto */
static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* VoidPtrImport.proto */
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_init(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, bool __pyx_v_suppress_ticking, bool __pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_all_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_all_keys, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_reset_storage(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_reset(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_positions(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_v_positions); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_signals(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<std::vector<std::vector<std::string> > >  __pyx_v_signals); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_positions(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::unordered_map<std::string,std::vector<double> >  __pyx_v_merged_positions); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_total_balances(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<std::vector<double> >  __pyx_v_total_balances); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_total_balances(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<double>  __pyx_v_merged_total_balances); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals_at_step_t(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_positions, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_signals_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_signals, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_positions, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_total_balances, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_total_balances, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__signals_at_step_t_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, bool __pyx_v_append_to_results, std::vector<std::vector<std::string> >  *__pyx_v_ret_signals, std::vector<std::unordered_map<std::string,double> >  *__pyx_v_ret_positions, std::vector<double>  *__pyx_v_ret_total_balances); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, PyObject *__pyx_v_append_to_results, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_add_signal(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, long __pyx_v_i, std::string __pyx_v_signal, int __pyx_skip_dispatch); /* proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data, std::vector<std::vector<std::vector<std::string> > >  *__pyx_v_ret_signals, std::unordered_map<std::string,std::vector<std::vector<double> > >  *__pyx_v_ret_positions, std::unordered_map<std::string,std::vector<double> >  *__pyx_v_ret_merged_positions, std::vector<std::vector<double> >  *__pyx_v_ret_total_balances, std::vector<double>  *__pyx_v_ret_merged_total_balances); /* proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data, int __pyx_skip_dispatch); /* proto*/

/* Module declarations from 'libcpp' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libcpp.string' */

/* Module declarations from 'libcpp.utility' */

/* Module declarations from 'libcpp.unordered_map' */

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'cython' */

/* Module declarations from 'trapeza.arithmetics.arithmetics' */
static __pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t *__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_add = 0;
#define __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_add (*__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_add)
static __pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t *__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_subtract = 0;
#define __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_subtract (*__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_subtract)
static __pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t *__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_multiply = 0;
#define __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_multiply (*__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_multiply)
static __pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t *__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_divide = 0;
#define __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_divide (*__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_divide)

/* Module declarations from 'trapeza.strategy.fx_strategy' */
static PyTypeObject *__pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy = 0;
static short __pyx_f_7trapeza_8strategy_11fx_strategy__c_tick_method(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy___pyx_unpickle_cFXStrategy__set_state(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &); /*proto*/
static PyObject *__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(std::unordered_map<long,std::vector<std::string> >  const &); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/
static std::unordered_map<long,std::vector<std::string> >  __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &); /*proto*/
static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(std::unordered_map<std::string,std::vector<double> >  const &); /*proto*/
static std::vector<double>  __pyx_convert_vector_from_py_double(PyObject *); /*proto*/
static std::unordered_map<std::string,std::vector<double> >  __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(const std::vector<std::vector<double> >  &); /*proto*/
static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(std::unordered_map<std::string,std::vector<std::vector<double> > >  const &); /*proto*/
static std::vector<std::vector<double> >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(PyObject *); /*proto*/
static std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(const std::vector<std::vector<std::string> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(const std::vector<std::vector<std::vector<std::string> > >  &); /*proto*/
static std::vector<std::vector<std::string> >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(PyObject *); /*proto*/
static std::vector<std::vector<std::vector<std::string> > >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(PyObject *); /*proto*/
static std::vector<long>  __pyx_convert_vector_from_py_long(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "trapeza.strategy.fx_strategy"
extern int __pyx_module_is_main_trapeza__strategy__fx_strategy;
int __pyx_module_is_main_trapeza__strategy__fx_strategy = 0;

/* Implementation of 'trapeza.strategy.fx_strategy' */
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_ValueError;
static const char __pyx_k_e[] = "e";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_acc[] = "acc";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_inp[] = "inp";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_run[] = "run";
static const char __pyx_k__100[] = "_";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tick[] = "tick";
static const char __pyx_k_chain[] = "chain";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_clock[] = "clock";
static const char __pyx_k_depot[] = "depot";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_reset[] = "_reset";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_c_init[] = "c_init";
static const char __pyx_k_c_name[] = "c_name";
static const char __pyx_k_c_tick[] = "c_tick";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_kwargs[] = "**kwargs";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_setter[] = "setter";
static const char __pyx_k_signal[] = "signal";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_c_clock[] = "_c_clock";
static const char __pyx_k_c_reset[] = "c_reset";
static const char __pyx_k_deleter[] = "deleter";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_reset_2[] = "reset";
static const char __pyx_k_signals[] = "signals";
static const char __pyx_k_trapeza[] = "trapeza";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_accounts[] = "accounts";
static const char __pyx_k_all_keys[] = "all_keys";
static const char __pyx_k_callable[] = "callable";
static const char __pyx_k_evaluate[] = "evaluate";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_kwargs_2[] = "kwargs";
static const char __pyx_k_len_data[] = "len_data";
static const char __pyx_k_lookback[] = "lookback";
static const char __pyx_k_position[] = "position";
static const char __pyx_k_property[] = "property";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_positions[] = "positions";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_signature[] = "signature";
static const char __pyx_k_tick_func[] = "tick_func";
static const char __pyx_k_FXStrategy[] = "FXStrategy";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_add_signal[] = "add_signal";
static const char __pyx_k_c_accounts[] = "c_accounts";
static const char __pyx_k_c_lookback[] = "c_lookback";
static const char __pyx_k_c_position[] = "c_position";
static const char __pyx_k_c_wrap_run[] = "c_wrap_run";
static const char __pyx_k_data_frame[] = "data_frame";
static const char __pyx_k_parameters[] = "parameters";
static const char __pyx_k_price_data[] = "price_data";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_BaseAccount[] = "BaseAccount";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_accs_clocks[] = "_accs_clocks";
static const char __pyx_k_cFXStrategy[] = "cFXStrategy";
static const char __pyx_k_check_types[] = "check_types";
static const char __pyx_k_name_setter[] = "name setter";
static const char __pyx_k_tick_kwargs[] = "tick_kwargs";
static const char __pyx_k_tick_method[] = "tick_method";
static const char __pyx_k_volume_data[] = "volume_data";
static const char __pyx_k_AccountError[] = "AccountError";
static const char __pyx_k_BaseStrategy[] = "BaseStrategy";
static const char __pyx_k_c_add_signal[] = "c_add_signal";
static const char __pyx_k_intersection[] = "intersection";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_ProtectedDict[] = "ProtectedDict";
static const char __pyx_k_ProtectedList[] = "ProtectedList";
static const char __pyx_k_c_accs_clocks[] = "_c_accs_clocks";
static const char __pyx_k_c_tick_kwargs[] = "c_tick_kwargs";
static const char __pyx_k_c_tick_method[] = "c_tick_method";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_reset_storage[] = "_reset_storage";
static const char __pyx_k_strategy_func[] = "strategy_func";
static const char __pyx_k_tick_method_2[] = "_tick_method";
static const char __pyx_k_total_balance[] = "total_balance";
static const char __pyx_k_tpz_exception[] = "tpz_exception";
static const char __pyx_k_trapeza_utils[] = "trapeza.utils";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_FXStrategy_run[] = "FXStrategy.run";
static const char __pyx_k_OperatingError[] = "OperatingError";
static const char __pyx_k_account_setter[] = "account setter";
static const char __pyx_k_exchange_rates[] = "exchange_rates";
static const char __pyx_k_price_data_key[] = "price_data_key";
static const char __pyx_k_signals_setter[] = "signals setter";
static const char __pyx_k_total_balances[] = "total_balances";
static const char __pyx_k_FXStrategy_name[] = "FXStrategy.name";
static const char __pyx_k_c_reset_storage[] = "_c_reset_storage";
static const char __pyx_k_c_strategy_func[] = "c_strategy_func";
static const char __pyx_k_c_tick_method_2[] = "_c_tick_method";
static const char __pyx_k_c_total_balance[] = "c_total_balance";
static const char __pyx_k_c_wrap_evaluate[] = "c_wrap_evaluate";
static const char __pyx_k_lookback_setter[] = "lookback setter";
static const char __pyx_k_position_setter[] = "position setter";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_signals_from_py[] = "signals_from_py";
static const char __pyx_k_strategy_kwargs[] = "strategy_kwargs";
static const char __pyx_k_volume_data_key[] = "volume_data_key";
static const char __pyx_k_FXStrategy_reset[] = "FXStrategy.reset";
static const char __pyx_k_init_accs_depots[] = "_init_accs_depots";
static const char __pyx_k_merged_positions[] = "merged_positions";
static const char __pyx_k_position_from_py[] = "position_from_py";
static const char __pyx_k_price_data_value[] = "price_data_value";
static const char __pyx_k_suppress_ticking[] = "suppress_ticking";
static const char __pyx_k_tick_func_setter[] = "tick_func setter";
static const char __pyx_k_tick_param_names[] = "tick_param_names";
static const char __pyx_k_FXStrategy___init[] = "FXStrategy.__init__";
static const char __pyx_k_append_to_results[] = "append_to_results";
static const char __pyx_k_c_strategy_kwargs[] = "c_strategy_kwargs";
static const char __pyx_k_positions_from_py[] = "positions_from_py";
static const char __pyx_k_signals_at_step_t[] = "_signals_at_step_t";
static const char __pyx_k_volume_data_value[] = "volume_data_value";
static const char __pyx_k_FXStrategy_signals[] = "FXStrategy.signals";
static const char __pyx_k_accs_clocks_setter[] = "_accs_clocks setter";
static const char __pyx_k_c_init_accs_depots[] = "_c_init_accs_depots";
static const char __pyx_k_c_suppress_ticking[] = "c_suppress_ticking";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_init_all_positions[] = "_init_all_positions";
static const char __pyx_k_reference_currency[] = "reference_currency";
static const char __pyx_k_self_parse_signals[] = "self_parse_signals";
static const char __pyx_k_tick_kwargs_setter[] = "tick_kwargs setter";
static const char __pyx_k_FXStrategy_accounts[] = "FXStrategy.accounts";
static const char __pyx_k_FXStrategy_evaluate[] = "FXStrategy.evaluate";
static const char __pyx_k_FXStrategy_lookback[] = "FXStrategy.lookback";
static const char __pyx_k_FXStrategy_positions[] = "FXStrategy.positions";
static const char __pyx_k_c_init_all_positions[] = "_c_init_all_positions";
static const char __pyx_k_check_parse_accounts[] = "_check_parse_accounts";
static const char __pyx_k_ignore_type_checking[] = "ignore_type_checking";
static const char __pyx_k_self_parse_positions[] = "self_parse_positions";
static const char __pyx_k_strategy_func_setter[] = "strategy_func setter";
static const char __pyx_k_strategy_param_names[] = "strategy_param_names";
static const char __pyx_k_FXStrategy_add_signal[] = "FXStrategy.add_signal";
static const char __pyx_k_merged_total_balances[] = "merged_total_balances";
static const char __pyx_k_total_balances_setter[] = "total_balances setter";
static const char __pyx_k_FXStrategy_tick_kwargs[] = "FXStrategy.tick_kwargs";
static const char __pyx_k_FXStrategy_tick_method[] = "FXStrategy.tick_method";
static const char __pyx_k_c_ignore_type_checking[] = "_c_ignore_type_checking";
static const char __pyx_k_ignore_type_checking_2[] = "_ignore_type_checking";
static const char __pyx_k_price_data_key_tuple_0[] = "price_data_key_tuple_0";
static const char __pyx_k_price_data_key_tuple_1[] = "price_data_key_tuple_1";
static const char __pyx_k_strategy_kwargs_setter[] = "strategy_kwargs setter";
static const char __pyx_k_total_balances_from_py[] = "total_balances_from_py";
static const char __pyx_k_FXStrategy__accs_clocks[] = "FXStrategy._accs_clocks";
static const char __pyx_k_FXStrategy__tick_method[] = "FXStrategy._tick_method";
static const char __pyx_k_init_accs_depots_setter[] = "_init_accs_depots setter";
static const char __pyx_k_merged_positions_setter[] = "merged_positions setter";
static const char __pyx_k_suppress_ticking_setter[] = "suppress_ticking setter";
static const char __pyx_k_volume_data_key_tuple_0[] = "volume_data_key_tuple_0";
static const char __pyx_k_volume_data_key_tuple_1[] = "volume_data_key_tuple_1";
static const char __pyx_k_FXStrategy_strategy_func[] = "FXStrategy.strategy_func";
static const char __pyx_k_intersection_param_names[] = "intersection_param_names";
static const char __pyx_k_merged_positions_from_py[] = "merged_positions_from_py";
static const char __pyx_k_pyx_unpickle_cFXStrategy[] = "__pyx_unpickle_cFXStrategy";
static const char __pyx_k_signals_at_step_t_setter[] = "_signals_at_step_t setter";
static const char __pyx_k_FXStrategy__reset_storage[] = "FXStrategy._reset_storage";
static const char __pyx_k_FXStrategy_total_balances[] = "FXStrategy.total_balances";
static const char __pyx_k_self_parse_total_balances[] = "self_parse_total_balances";
static const char __pyx_k_signals_at_step_t_from_py[] = "_signals_at_step_t_from_py";
static const char __pyx_k_FXStrategy_strategy_kwargs[] = "FXStrategy.strategy_kwargs";
static const char __pyx_k_FXStrategy_merged_positions[] = "FXStrategy.merged_positions";
static const char __pyx_k_FXStrategy_suppress_ticking[] = "FXStrategy.suppress_ticking";
static const char __pyx_k_key_in_position_setter_dict[] = "key in position setter dict";
static const char __pyx_k_self_parse_merged_positions[] = "self_parse_merged_positions";
static const char __pyx_k_FXStrategy__init_accs_depots[] = "FXStrategy._init_accs_depots";
static const char __pyx_k_merged_total_balances_setter[] = "merged_total_balances setter";
static const char __pyx_k_self_parse_signals_at_step_t[] = "self_parse_signals_at_step_t";
static const char __pyx_k_trapeza_account_base_account[] = "trapeza.account.base_account";
static const char __pyx_k_trapeza_strategy_fx_strategy[] = "trapeza.strategy.fx_strategy";
static const char __pyx_k_FXStrategy__signals_at_step_t[] = "FXStrategy._signals_at_step_t";
static const char __pyx_k_is_order_manager_monkey_patch[] = "_is_order_manager_monkey_patch";
static const char __pyx_k_merged_total_balances_from_py[] = "merged_total_balances_from_py";
static const char __pyx_k_value_in_position_setter_dict[] = "value in position setter dict";
static const char __pyx_k_FXStrategy__init_all_positions[] = "FXStrategy._init_all_positions";
static const char __pyx_k_trapeza_strategy_base_strategy[] = "trapeza.strategy.base_strategy";
static const char __pyx_k_Derived_from_BaseStrategy_class[] = "\n    Derived from BaseStrategy class. This implementation is meant to be used with FXAccount (patched by\n    trapeza.account.order_management.monkey_patch() and unpatched version), but in principal can be used with any\n    class derived from BaseAccount.\n\n    Ties (multiple) accounts and a strategy decision function to one logical unit, such that strategy decision function\n    only has to implement trading logic without caring about e.g. tick handling (cf. time discrete state machine/\n    stacked automaton logic implementation by FXAccount) or evaluation of trades and result parsing.\n\n    FXStrategy tries to tick (cf. time discrete state machine/ stack automaton logic implementation by FXAccount)\n    FXAccount, if FXAccount.clock is not already ticked within strategy decision function separately (auto-detection\n    whether accounts have been ticked within strategy decision function)\n    and self.suppress_ticking=False, which controls if ticking is conducted within FXStrategy.\n\n    Data supplied to FXStrategy.run() is looped through time step by time step. Thereby, parameter lookback controls\n    how much historic data is supplied to the strategy decision function at each time step (e.g. how many previous\n    time steps are passed to strategy decision function in addition to current time step).\n    At each time step during looping through supplied data, strategy function is called once, all accounts are ticked\n    (auto-detection whether ticking has already been done within strategy function) and evaluated repeatedly.\n    As the parameter lookback controls the size of historic data, the start time step is located at index=lookback\n    (zero-based indexing) within data supplied to FXStrategy.run(), every data located before the index=lookback is\n    treated as historic data (therefore trading strategy starts at index=lookback as first 'current' time step and\n    then continuously loops through every remaining time step in data).\n    Nonetheless,"" input data has to be prepended/ padded manually with historic data (this is not done automatically)\n    before FXStrategy.run() method is called.\n\n    A separate tick function can be supplied, otherwise tick method (call signature) of FXAccount (respective\n    monkey patched account by order_management) will be applied, provided that self.suppress_ticking=False.\n    Auto-detects if account was patched by trapeza.account.order_management.monkey_patch() and then applies\n    appropriate tick method. If self.suppress_ticking=True, ticking is suppressed (at least FXStrategy.run() does\n    not try to tick accounts, accounts still can be ticked from within strategy decision function).\n    Custom tick function must follow call signature:\n\n        tick_func(self, data_point_t, **kwargs)\n\n        self: placeholder in function signature in order to access self of this class\n        data_point: dict with key:tuple(str, str) and value: float,\n                    {(base, quote): current_rate,\n                     (base, quote): current_rate,\n                      ...}\n                    dictionary of base and quote currency pair and their respective exchange rate\n                    in FX direct notation base|quote (see docstring of FXAccount class for notation convention).\n                    This argument is auto-generated within FXStrategy.run() (in the sense, that data supplied to\n                    FXStrategy.run() is parsed to only containing current time step before passing to tick method) and\n                    passed to tick_func automatically within method call.\n                    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                    Make sure custom tick_func accepts this data format\n                    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n        kwargs: additionally kwargs arguments,\n                kwargs of tick_func can be passed to param:kwargs of FXStrategy.__init__(). parm:kwargs must be\n         ""       contained with identical names in param:kwargs, which are passed to FXStrategy.__init__(),\n                see param:kwargs of FXStrategy.__init__().\n                Similar names to kwargs of strategy_func are not allowed.\n\n    Separate kwargs for tick function and strategy function can be supplied to FXStrategy.__init__() as one kwarg,\n    as long as both do not share similar named kwarg arguments.\n\n    self.reset() is called during backtesting and resets accounts (make sure, accounts implemented a reset method\n    similar to FXAccount) as well as stored results (see below).\n\n    self.run() is called during backtesting and in turn calls strategy decision functions. Handles setup (resetting\n    stored results as well as accounts), data feed to strategy decision function (see above) and parsing of results\n    (see below). Data has to be supplied as dict:\n    {(base, quote): [val_0, val_1, ..., val_t], (base, quote): [val_0, val_1, ..., val_t]}, where val_t is the\n    exchange rate at time step t in FX notation (direct notation as quote-base-pair, see FXAccount).\n    Same logic applies to volume data passed into self.run() (if volume data is not None, see parameter description for\n    more information, how volume data is handled and processed).\n    If lookback is used, then prepend/ pad historic data of lookback to data dict manually as this is not handled\n    automatically (price data as well as volume data passed into self.run()).\n\n    Exchange rate is expressed in FX direct notation convention (direct notation, not volume notation):\n    1.2 EUR|USD --> 1.2 USD for 1 EUR (see docstring of FXAccount class for further information on notation convention)\n\n    In order to evaluate trade signals, FXStrategy class object has to be used by strategy decision function in order to\n    'transmit' trade signals emitted by strategy logic: call FXStrategy.add_signal(acc, signal_str) within strategy\n    decision function (pass FXStrategy object as ""function argument to externally defined strategy decision function).\n    Signals can be any string, e.g. 'sell', 'buy', 'short', 'long'. Multiple signals can be\n    'transmitted' by repeatedly calling FXStrategy.add_signal() method. Signals are only evaluable if strategy decision\n    function calls FXStrategy.add_signal(acc, signal_str).\n    Additionally, if signals contain the name of the currency (which are used within tuple of strings as key of price\n    data), then signals will be visualized more concise within dashboard (see FXDashboard). Furthermore, see\n    FXDashboard for how to construct strings for signals in order to extend visualization capabilities of analysis\n    dashboard (e.g. formatting of signals dependent whether they contain certain key words such as 'sell' or 'buy').\n\n\n    Input data to FXStrategy.run() is given as:\n        {(base, quote): [rate_0, rate_1, ..., rate_t],\n         (base, quote): [rate_0, rate_1, ..., rate_t],\n         ...}\n        All values (list or array of floats) of all keys (currency pairs) have to be of same length.\n        If historic data shall be used by strategy_func (cf. lookback), historic data has to be prepended\n        manually to param:data, e.g.:\n            lookback = 3\n            {(base, quote): [rate_-3, rate_-2, rate_-1, rate_0, rate_1, ... rate_t],\n             (base, quote): [rate_-3, rate_-2, rate_-1, rate_0, rate_1, ... rate_t],\n             ...}\n        Data will be looped through one by one (time frame specified by lookback and current time step t\n        [window size: lookback + 1]). Start time step is at index=lookback. Applies for price data and volume data as\n        well. Exchange rate is expressed in FX notation convention (direct notation, not volume notation)\n        1.2 EUR|USD --> 1.2 USD for 1 EUR\n\n    Strategy decision function does not need to return anything as FXStrategy.evaluate() takes care of results\n    (as long as strategy decision function internally calls"" methods of FXAccount object).\n    Strategy decision function must take on following call signature:\n\n        strategy_func(accounts, price_data_point, reference_currency, volume_data_point, fxstrategy, **strategy_kwargs):\n            accounts: list (!) of account objects (inherited from BaseAccount)\n            price_data_point: dict with key:tuple(str, str) and value:float or value:list of floats\n                              or value:array of floats,\n                              {(base, quote): current_rate,\n                              (base, quote): current_rate,\n                               ...}\n                               or\n                              {(base, quote): [rate_-2, rate_-1, current_rate],\n                               (base, quote): [rate_-2, rate_-1, current_rate],\n                               ...}\n                              --> dependent on size of parameter lookback (whether to prepend historic data to each call\n                                  to strategy decision function for each loop within FXStrategy.run())\n                             dictionary of base and quote currency pair and their respective exchange\n                             rate in FX direct Notation base|quote (or volume data in case of volume_data,\n                             see self.run()).\n                             Whether floats or list/ array of floats are used as dict values, is dependent on the\n                             parameter lookback.\n            reference_currency: str,\n                                reference currency in which results shall be quoted\n            volume_data_point: None or dict,\n                               If None (passed in at self.run()), None will be passed into strategy_func at each call\n                               (see self.run()).\n                               If dict, then same format (and logic) as price_data_point.\n            fxstrategy: initiated FXStrategy class object used fo""r adding signals within strategy_func via\n                        fxstrategy.add_signal(acc, signal_str)\n            strategy_kwargs: dict,\n                             additional custom key word arguments\n                             kwargs of strategy_func can be passed to param:kwargs of FXStrategy.__init__().\n                             param:strategy_kwargs must be contained with identical names in param:kwargs, which are\n                             passed to FXStrategy.__init__(), see param:kwargs of FXStrategy.__init__().\n                             Similar names to kwargs of tick_func are not allowed (name mangling).\n\n    Results are stored within class object in the following format:\n    self.signals: list of lists,\n                  gives all signals per account and per time step, which are generated by strategy decision function\n\n                     | signals of account 0               | signals of account 1               |...\n                     V                                    V                                    V\n                  [[[acc_0_sig_t_0, acc_0_sig_t_0, ...], [acc_1_sig_t_0, acc_1_sig_t_0, ...], [...]],   <-- time step 0\n                   [[acc_0_sig_t_1, acc_0_sig_t_1, ...], [acc_1_sig_t_1, acc_1_sig_t_1, ...], [...]],   <-- time step 1\n                   ...]\n\n                   access data via: time_step, acc, signal_nr\n\n    self.positions: dict: currency (str) as key, list of lists as values of position of account n at time step t\n                    gives all positions (currencies) and their value (size, amount, volume) per account and\n                    per time step\n\n                                 | account 0  | account 1  ...  | account n\n                                 V            V                 V\n                    {currency: [[acc_0_val_0, acc_1_val_0, ..., acc_n_val_0],    <-- time step 0\n                                [acc_0_val_1, acc_1_val_1, ..., acc_n_val_1],    <-- time step 1""\n                                 ... ... ...\n                                [acc_0_val_t, acc_1_val_t, ..., acc_n_val_t]],   <-- time step n\n                     currency: ...}\n\n                     access data via: position, time_step, acc_nr\n\n    self.merged_positions: dict: currency (str) as key, list as values per time step\n                           sums up all similar positions across all accounts to one\n                           composite position (currency) per time step\n\n                           {currency: [val_0, ..., val_t],\n                            currency: [val_0, ..., val_t]}\n\n                           access data via: position, time_step\n\n    self.total_balances: list of lists,\n                         gives total account value (over all positions) in specified reference currency per each\n                         account and time step\n\n                             | account 0        | account 1        | ...\n                             V                  V                  V\n                           [[balance_acc_0_t_0, balance_acc_1_t_0, ...],    <-- time step 0\n                            [balance_acc_0_t_1, balance_acc_1_t_1, ...],    <-- time step 1\n                            ...]\n\n                         access data via: time_step, acc_nr\n\n    self.merged_total_balances: list,\n                                sums up total balances of all accounts per each time step; total balances are\n                                all set to same reference currency; resembles total value of strategy with\n                                respect to all used accounts per time step\n\n                                  |time step 0 |time step 1 |...\n                                  V            V            V\n                                 [balance_t_0, balance_t_1, ....]\n\n                                access data via: time_step\n    Internally stored results will be accessed by backtesting engine, therefore do n""ot disturb or manipulate\n    those values manually. Furthermore, retrieving class attributes via e.g. self.signals returns a ProtectedDict (or\n    ProtectedList, see implementation in trapeza.utils). Those ProtectedDicts are immutable. This is because FXStrategy\n    wraps an underlying C++ implementation, and manipulating single indices/ elements of e.g. self.signals directly\n    would not take effects on the underlying C++ implementation. Instead, users have to set a whole list (or dict)\n    directly, if class attributes shall be manipulated, e.g. self.signals = some_list (see setter methods\n    of FXStrategy).\n\n    At each call to run, FXStrategy internal storage (which holds final results) and accounts are reset.\n    Additionally depots of accounts are reset to the same depot status as when FXStrategy.__init__() was called (this\n    is stored in self._init_accs_depots, see notes above on ProtectedDicts/ ProtectedLists).\n    This also applies to clocks of accounts at time of initialization of FXStrategy as they are restored as well after\n    each run (see self._acc_clocks). This means, FXStrategy.run() can be called repeatedly in such a way, that each call\n    simulates an independent simulation run starting from the same account status as at time of FXStrategy.__init__() at\n    every run. Calling FXStrategy.run() repeatedly is therefore safe and every time just simulates starting as if\n    accounts have been freshly initialized with their initial account.depot and account.clock status as well as a fresh\n    internal storage of FXStrategy. Internal reset is done BEFORE each run, but not after!\n\n    Quick Start:\n        >>  # define custom strategy decision function, make sure it follows call signature defined above\n        >>  def awesome_strategy(accounts, price, reference_currency, volume, fxstrat):\n        >>      # implement custom decision logic for one time step\n        >>      [custom trade logic, which only can operate on current time"" step + historic lookback of\n        >>       price and volume data]\n        >>\n        >>      # add signal called whatever you want, which is executed by certain account; use FXStrategy object\n        >>      fxstrat.add_signal(accounts[0], 'awesome_transaction')  # str: signal name\n        >>\n        >>      # add signal called whatever you want, which is executed by another account; use FXStrategy object\n        >>      fxstrat.add_signal(accounts[1], 'great_transaction')    # str: signal name\n        >>\n        >>      # execute trades with both accounts\n        >>      accounts[0].awesome_transaction(...)    # some arbitrary transaction conducted by account 0\n        >>      accounts[1].great_transaction(...)      # some arbitrary transaction conducted by account 1\n        >>\n        >>  # open up (init) two accounts\n        >>  accs = [FXAccount(...) for _ in range(2)]\n        >>\n        >>  # init FXStrategy class object\n        >>  strat = FXStrategy('genesis', accs, awesome_strategy, lookback=0)\n        >>\n        >>  # accounts and decision function are now registered as one logical unit and are ready for backtesting\n        >>  strat.run(all_price_data, 'USD', all_volume_data)\n        >>  # alternatively if awesome_strategy() does not need any volume data for its trade logic:\n        >>  # strat.run(all_price_data, 'USD', None)\n\n    Customization of iteration/ looping logic:\n    If a more granular control of account behavior is needed within the strategy decision function, iteration/ looping\n    logic of FXStrategy.run() can be suppressed by setting the parameter lookback to\n    'lookback = length of data (number of max. time steps) - 1'. This limits the number of calls to the strategy\n    decision function effectively to only once within FXStrategy.run() method, such that looping and ticking can be\n    done entirely within strategy decision function without outside interference of FXStrategy.run().\n    Nonetheless, ticking ""and evaluation have to been done manually then within strategy decision function.\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    Therefore first add all signals and tick all account clocks before calling FXStrategy.evaluate().\n    Make sure, append_to_results is set to True when calling FXStrategy.evaluate().\n    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    FXStrategy.evaluate(): when append_to_results is set to False, accounts will be evaluated (but not internally\n    altered, so repeated call to evaluate is safe in the sense of not changing internal states of accounts and\n    retrieving same results after each call), but evaluation results will not be written to internal storage of results\n    within FXStrategy. Results are therefore not accessible for backtest evaluation. Repeated call to\n    FXStrategy.evaluate is safe not to alter any data and delivers same results after each call if append_to_results\n    is set to False.\n    If append_to_results is set to True, evaluation results will be written to internal storage of results within\n    FXStrategy and are accessible for backtest analysis. Every call to FXStrategy.evaluate() resembles the evaluation\n    at one sequential time step t+1 if append_to_results is set to True. So whenever a time step is passed, make a\n    call to FXStrategy.evaluate(). This has only to be done, if ticking and evaluation is done manually in\n    strategy decision function. If the users relays on the auto-ticking during FXStrategy.run(), FXStrategy.evaluate()\n    does not need to be called separately.\n    !!! In order to retrieve correct results, first tick all account clocks (cf. internal time discrete state machine\n        within FXAccount) to make sure, all transactions take place at evaluation !!!\n    !!! FXStrategy.evaluate() cleans internal short term storage of sign""als (if append_to_results=True).\n        This means, after calling FXStrategy.evaluate(), all signals which are appended via FXStrategy.add_signal()\n        afterwards are assigned to the next time step/ until next call to FXStrategy.evaluate(). All signals, which are\n        added before call to FXStrategy.evaluate(), will be assigned to the same time step as FXStrategy.evaluate()\n        (internal storage will be cleaned after method call such that adding new signals will not interfere with\n        previously added signals)\n        (keep in mind to first tick all accounts before calling FXStrategy.evaluate(), otherwise accounts will not\n        perform desired transactions within strategy decision function, especially when processing durations are\n        involved) !!!\n    When calling FXStrategy.evaluate() manually and accounts are patched by\n    trapeza.account.order_management.monkey_patch(), then account.tick(data_point_t_including_lookback) must be\n    assembled manually whenever accounts are ticked from inside strategy decision function. This means, data passed to\n    account.tick() has to include current time step (set manually) including all historic data according to lookback\n    (as mentioned earlier, volume data is only used for trading logic, but not for ticking accounts or evaluating\n    strategy).\n    Example:\n        >>  # define custom strategy decision function, make sure it follows call signature defined above\n        >>  def awesome_strategy(accounts, price, reference_currency, volume, fxstrat):\n        >>      # implement custom decision logic, which only gets called once but has the entire data set available\n        >>      # for calculations, which was passed to fxstrat.run()\n        >>      [custom trade logic, which can operate on the whole data set for prices and volumes]\n        >>\n        >>      # add signal called whatever you want, which is executed by certain account; use FXStrategy object\n        >>      fxstr""at.add_signal(accounts[0], 'awesome_transaction')  # str: signal name\n        >>\n        >>      # add signal called whatever you want, which is executed by an other account; use FXStrategy object\n        >>      fxstrat.add_signal(accounts[1], 'great_transaction')    # str: signal name\n        >>\n        >>      # execute trades with both accounts\n        >>      accounts[0].awesome_transaction(...)\n        >>      accounts[1].great_transaction(...)\n        >>\n        >>      # tick accounts: data_point is all data at corresponding time step t plus historic lookback as dict\n        >>      _ = [acc.tick() for acc in accounts]    # alternatively: acc.tick(data_point_t_including_lookback)\n        >>\n        >>      # evaluate and store results: pass data argument as same variable from strategy function argument\n        >>      # argument data is the same variable for awesome_strategy() as well as fxstrat.evaluate\n        >>      fxstrat.evaluate(data, reference_currency, append_to_results=True)\n        >>\n        >>      # from here on a new time step starts:\n        >>      [custom trade logic, which can operate on the whole data set for prices and volumes]\n        >>      [add signals]\n        >>      [make transactions]\n        >>      [tick accounts with data_point_t+1_including_lookback]\n        >>      [evaluate]\n        >>\n        >>      # and so on and so forth\n        >>      # volume data is not needed for ticking or evaluating, but solely for custom trade logic\n        >>\n        >>  # init FXStrategy class object, force run() to only run once by setting appropriate lookback\n        >>  strat = FXStrategy('genesis', accs, awesome_strategy, lookback=length_of_data - 1)\n        >>\n        >>  # accounts and decision function are now registered as one logical unit and are ready for backtesting\n        >>  strat.run(all_price_data, 'USD', all_volume_data)\n        >>  # alternatively if awesome_strategy() does not need any volume"" data for its trade logic:\n        >>  # strat.run(all_price_data, 'USD', None)\n\n    Results of the run simulation of FXStrategy can be accessed by the class object attributes:\n        'FXStrategy.positions', 'FXStrategy.merged_positions', 'FXStrategy.total_balances',\n        'FXStrategy.merged_total_balances', 'FXStrategy.signals'\n        (ProtectedDicts/ ProtectedLists will be returned, single indices/ elements are immutable and can not be\n        manipulated directly. Cast to dict/ list via new variable if single elements shall be manipulated.)\n    Those results can be plotted easily via:\n        >>  from matplotlib import pyplot as plt\n        >>\n        >>  # plot time series of the total strategy balance across all accounts referenced in 'USD' after running\n        >>  # strategy simulation via fxstrat.run(...)\n        >>  plt.figure()\n        >>  plt.plot(range(len_data), fxstrat.merged_total_balances)\n\n    Regarding the strategy decision function parameter 'accounts', a list of accounts is always passed to strategy\n    decision function during self.run().\n    Even if a single account is passed to FXStrategy.__init__, strategy decision function will receive a list of\n    account(s), e.g. in this case [acc_0] if FXStrategy('genesis', acc_0, awesome_strategy, lookback=42).\n\n    For adding signals, FXStrategy.add_signal() will automatically assign signal string to the right account, which\n    is passed as argument to FXStrategy.add_signal(account, signal). Signals in FXStrategy.signals (internal storage\n    holding final results after FXStrategy.run()) are in the same order as the list of accounts passed\n    to FXStrategy.__init__().\n\n    !!! kwargs of tick_func and kwargs of strategy_func must not share same argument names (name conflicts) !!!\n\n    If FXDashboard shall be used for visualization:\n            if signal string contains currency (or whatever is defined by data dict, see FXStrategy.run()) as substring,\n            signa""l will be appropriately visualized on the same line chart as currency. If signal string contains\n            one of the keys of param:signal_symbols dict at FXDashboard.__init__ as substring, signal will be\n            appropriately visualized with therein defined symbol shape and color.\n            signal string therefore must not contain multiple currencies as substring, nor multiple keys of\n            param:signal_symbols dict at FXDashboard.__init__, but only one currency and only one key of\n            param:signal_symbols as substring.\n            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n            !!! signal names, which are appended with FXStrategy.add_signal(), should not contain multiple substrings\n                of either currencies (or assets or whatever defines keys of FXEngine.price_data dictionary) nor keys\n                of shape defining dictionary (param:signal_symbols at FXDashboard.__init__) !!!\n                Recommendation: signal names should be mutual free of substring parts to each other,\n                otherwise they might be visualized multiple times at FXDashboard !!!\n            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    ";
static const char __pyx_k_accs_clocks_setter_list_must_co[] = "_accs_clocks setter list must contain floats";
static const char __pyx_k_init_accs_depots_setter_list_mu[] = "_init_accs_depots setter list must contain dicts";
static const char __pyx_k_Account_clocks_have_not_been_tic[] = "Account clocks have not been ticked although param:suppress_ticking=False specifies ticking behavior.";
static const char __pyx_k_Account_has_to_inherit_from_trap[] = "Account has to inherit from trapeza.account.base_account.BaseAccount.";
static const char __pyx_k_Data_does_not_contain_enough_tim[] = "Data does not contain enough time steps: {}. Data has to contain more time steps than specified by lookback: {}.";
static const char __pyx_k_FXStrategy__check_parse_accounts[] = "FXStrategy._check_parse_accounts";
static const char __pyx_k_FXStrategy__ignore_type_checking[] = "FXStrategy._ignore_type_checking";
static const char __pyx_k_FXStrategy_merged_total_balances[] = "FXStrategy.merged_total_balances";
static const char __pyx_k_Incompatible_checksums_s_vs_0x2f[] = "Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))";
static const char __pyx_k_Not_all_time_series_of_all_tuple[] = "Not all time series of all tuple keys within supplied price data dict have the same length.";
static const char __pyx_k_account_list_in_time_step_list_o[] = "account list in time step list of signals setter";
static const char __pyx_k_float_value_in_list_of_merged_to[] = "float value in list of merged_total_balances setter";
static const char __pyx_k_float_value_in_time_step_list_as[] = "float value in time step list as value of position setter dict";
static const char __pyx_k_float_value_in_time_step_list_of[] = "float value in time step list of total_balances setter";
static const char __pyx_k_float_value_in_value_list_of_mer[] = "float value in value list of merged_positions setter dict";
static const char __pyx_k_key_in__signals_at_step_t_setter[] = "key in _signals_at_step_t setter dict";
static const char __pyx_k_key_in_merged_positions_setter_d[] = "key in merged_positions setter dict";
static const char __pyx_k_list_as_value_in__signals_at_ste[] = "list as value in _signals_at_step_t setter dict";
static const char __pyx_k_param_strategy_func_and_param_ti[] = "param:strategy_func and param:tick_func have identically namedparameters/ kwargs, which makes it impossible to evaluateparam:**kwargs during class initialization. \n Identically named params: {}";
static const char __pyx_k_self_parse_merged_total_balances[] = "self_parse_merged_total_balances";
static const char __pyx_k_signal_of_account_in_signals_set[] = "signal of account in signals setter";
static const char __pyx_k_time_step_list_in_value_of_posit[] = "time step list in value of position setter dict";
static const char __pyx_k_time_step_list_of_signals_setter[] = "time step list of signals setter";
static const char __pyx_k_time_step_list_of_total_balances[] = "time step list of total_balances setter";
static const char __pyx_k_trapeza_strategy_fx_strategy_pyx[] = "trapeza\\strategy\\fx_strategy.pyx";
static const char __pyx_k_value_in_list_as_value_in__signa[] = "value in list as value in _signals_at_step_t setter dict";
static const char __pyx_k_value_in_merged_positions_setter[] = "value in merged_positions setter dict";
static PyObject *__pyx_n_s_AccountError;
static PyObject *__pyx_kp_u_Account_clocks_have_not_been_tic;
static PyObject *__pyx_kp_u_Account_has_to_inherit_from_trap;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BaseAccount;
static PyObject *__pyx_n_s_BaseStrategy;
static PyObject *__pyx_kp_u_Data_does_not_contain_enough_tim;
static PyObject *__pyx_kp_s_Derived_from_BaseStrategy_class;
static PyObject *__pyx_n_s_FXStrategy;
static PyObject *__pyx_n_s_FXStrategy___init;
static PyObject *__pyx_n_s_FXStrategy__accs_clocks;
static PyObject *__pyx_n_s_FXStrategy__check_parse_accounts;
static PyObject *__pyx_n_s_FXStrategy__ignore_type_checking;
static PyObject *__pyx_n_s_FXStrategy__init_accs_depots;
static PyObject *__pyx_n_s_FXStrategy__init_all_positions;
static PyObject *__pyx_n_s_FXStrategy__reset_storage;
static PyObject *__pyx_n_s_FXStrategy__signals_at_step_t;
static PyObject *__pyx_n_s_FXStrategy__tick_method;
static PyObject *__pyx_n_s_FXStrategy_accounts;
static PyObject *__pyx_n_s_FXStrategy_add_signal;
static PyObject *__pyx_n_s_FXStrategy_evaluate;
static PyObject *__pyx_n_s_FXStrategy_lookback;
static PyObject *__pyx_n_s_FXStrategy_merged_positions;
static PyObject *__pyx_n_s_FXStrategy_merged_total_balances;
static PyObject *__pyx_n_s_FXStrategy_name;
static PyObject *__pyx_n_s_FXStrategy_positions;
static PyObject *__pyx_n_s_FXStrategy_reset;
static PyObject *__pyx_n_s_FXStrategy_run;
static PyObject *__pyx_n_s_FXStrategy_signals;
static PyObject *__pyx_n_s_FXStrategy_strategy_func;
static PyObject *__pyx_n_s_FXStrategy_strategy_kwargs;
static PyObject *__pyx_n_s_FXStrategy_suppress_ticking;
static PyObject *__pyx_n_s_FXStrategy_tick_kwargs;
static PyObject *__pyx_n_s_FXStrategy_tick_method;
static PyObject *__pyx_n_s_FXStrategy_total_balances;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x2f;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_u_Not_all_time_series_of_all_tuple;
static PyObject *__pyx_n_s_OperatingError;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_ProtectedDict;
static PyObject *__pyx_n_s_ProtectedList;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s__100;
static PyObject *__pyx_n_s_acc;
static PyObject *__pyx_kp_u_account_list_in_time_step_list_o;
static PyObject *__pyx_kp_u_account_setter;
static PyObject *__pyx_n_s_accounts;
static PyObject *__pyx_n_s_accs_clocks;
static PyObject *__pyx_kp_u_accs_clocks_setter;
static PyObject *__pyx_kp_u_accs_clocks_setter_list_must_co;
static PyObject *__pyx_n_s_add_signal;
static PyObject *__pyx_n_s_all_keys;
static PyObject *__pyx_n_s_append_to_results;
static PyObject *__pyx_n_s_cFXStrategy;
static PyObject *__pyx_n_s_c_accounts;
static PyObject *__pyx_n_s_c_accs_clocks;
static PyObject *__pyx_n_s_c_add_signal;
static PyObject *__pyx_n_s_c_clock;
static PyObject *__pyx_n_s_c_ignore_type_checking;
static PyObject *__pyx_n_s_c_init;
static PyObject *__pyx_n_s_c_init_accs_depots;
static PyObject *__pyx_n_s_c_init_all_positions;
static PyObject *__pyx_n_s_c_lookback;
static PyObject *__pyx_n_s_c_name;
static PyObject *__pyx_n_s_c_position;
static PyObject *__pyx_n_s_c_reset;
static PyObject *__pyx_n_s_c_reset_storage;
static PyObject *__pyx_n_s_c_strategy_func;
static PyObject *__pyx_n_s_c_strategy_kwargs;
static PyObject *__pyx_n_s_c_suppress_ticking;
static PyObject *__pyx_n_s_c_tick;
static PyObject *__pyx_n_s_c_tick_kwargs;
static PyObject *__pyx_n_s_c_tick_method;
static PyObject *__pyx_n_s_c_tick_method_2;
static PyObject *__pyx_n_s_c_total_balance;
static PyObject *__pyx_n_s_c_wrap_evaluate;
static PyObject *__pyx_n_s_c_wrap_run;
static PyObject *__pyx_n_s_callable;
static PyObject *__pyx_n_s_chain;
static PyObject *__pyx_n_s_check_parse_accounts;
static PyObject *__pyx_n_s_check_types;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clock;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_frame;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_deleter;
static PyObject *__pyx_n_s_depot;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_evaluate;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_n_s_exchange_rates;
static PyObject *__pyx_kp_u_float_value_in_list_of_merged_to;
static PyObject *__pyx_kp_u_float_value_in_time_step_list_as;
static PyObject *__pyx_kp_u_float_value_in_time_step_list_of;
static PyObject *__pyx_kp_u_float_value_in_value_list_of_mer;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_ignore_type_checking;
static PyObject *__pyx_n_s_ignore_type_checking_2;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_accs_depots;
static PyObject *__pyx_kp_u_init_accs_depots_setter;
static PyObject *__pyx_kp_u_init_accs_depots_setter_list_mu;
static PyObject *__pyx_n_s_init_all_positions;
static PyObject *__pyx_n_s_inp;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_n_s_intersection;
static PyObject *__pyx_n_s_intersection_param_names;
static PyObject *__pyx_n_u_is_order_manager_monkey_patch;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_kp_u_key_in__signals_at_step_t_setter;
static PyObject *__pyx_kp_u_key_in_merged_positions_setter_d;
static PyObject *__pyx_kp_u_key_in_position_setter_dict;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_kp_u_kwargs;
static PyObject *__pyx_n_s_kwargs_2;
static PyObject *__pyx_n_s_len_data;
static PyObject *__pyx_kp_u_list_as_value_in__signals_at_ste;
static PyObject *__pyx_n_s_lookback;
static PyObject *__pyx_n_u_lookback;
static PyObject *__pyx_kp_u_lookback_setter;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_merged_positions;
static PyObject *__pyx_n_s_merged_positions_from_py;
static PyObject *__pyx_kp_u_merged_positions_setter;
static PyObject *__pyx_n_s_merged_total_balances;
static PyObject *__pyx_n_s_merged_total_balances_from_py;
static PyObject *__pyx_kp_u_merged_total_balances_setter;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_u_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_kp_u_name_setter;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_kp_u_param_strategy_func_and_param_ti;
static PyObject *__pyx_n_s_parameters;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_position;
static PyObject *__pyx_n_s_position_from_py;
static PyObject *__pyx_kp_u_position_setter;
static PyObject *__pyx_n_s_positions;
static PyObject *__pyx_n_s_positions_from_py;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_price_data;
static PyObject *__pyx_n_u_price_data;
static PyObject *__pyx_n_u_price_data_key;
static PyObject *__pyx_n_u_price_data_key_tuple_0;
static PyObject *__pyx_n_u_price_data_key_tuple_1;
static PyObject *__pyx_n_u_price_data_value;
static PyObject *__pyx_n_s_property;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_cFXStrategy;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reference_currency;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_reset_2;
static PyObject *__pyx_n_s_reset_storage;
static PyObject *__pyx_n_s_run;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_self_parse_merged_positions;
static PyObject *__pyx_n_s_self_parse_merged_total_balances;
static PyObject *__pyx_n_s_self_parse_positions;
static PyObject *__pyx_n_s_self_parse_signals;
static PyObject *__pyx_n_s_self_parse_signals_at_step_t;
static PyObject *__pyx_n_s_self_parse_total_balances;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_setter;
static PyObject *__pyx_n_s_signal;
static PyObject *__pyx_n_u_signal;
static PyObject *__pyx_kp_u_signal_of_account_in_signals_set;
static PyObject *__pyx_n_s_signals;
static PyObject *__pyx_n_s_signals_at_step_t;
static PyObject *__pyx_n_s_signals_at_step_t_from_py;
static PyObject *__pyx_kp_u_signals_at_step_t_setter;
static PyObject *__pyx_n_s_signals_from_py;
static PyObject *__pyx_kp_u_signals_setter;
static PyObject *__pyx_n_s_signature;
static PyObject *__pyx_n_s_strategy_func;
static PyObject *__pyx_n_u_strategy_func;
static PyObject *__pyx_kp_u_strategy_func_setter;
static PyObject *__pyx_n_s_strategy_kwargs;
static PyObject *__pyx_kp_u_strategy_kwargs_setter;
static PyObject *__pyx_n_s_strategy_param_names;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_suppress_ticking;
static PyObject *__pyx_n_u_suppress_ticking;
static PyObject *__pyx_kp_u_suppress_ticking_setter;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_tick;
static PyObject *__pyx_n_s_tick_func;
static PyObject *__pyx_kp_u_tick_func_setter;
static PyObject *__pyx_n_s_tick_kwargs;
static PyObject *__pyx_kp_u_tick_kwargs_setter;
static PyObject *__pyx_n_s_tick_method;
static PyObject *__pyx_n_s_tick_method_2;
static PyObject *__pyx_n_s_tick_param_names;
static PyObject *__pyx_kp_u_time_step_list_in_value_of_posit;
static PyObject *__pyx_kp_u_time_step_list_of_signals_setter;
static PyObject *__pyx_kp_u_time_step_list_of_total_balances;
static PyObject *__pyx_n_s_total_balance;
static PyObject *__pyx_n_s_total_balances;
static PyObject *__pyx_n_s_total_balances_from_py;
static PyObject *__pyx_kp_u_total_balances_setter;
static PyObject *__pyx_n_s_tpz_exception;
static PyObject *__pyx_n_s_trapeza;
static PyObject *__pyx_n_s_trapeza_account_base_account;
static PyObject *__pyx_n_s_trapeza_strategy_base_strategy;
static PyObject *__pyx_n_s_trapeza_strategy_fx_strategy;
static PyObject *__pyx_kp_s_trapeza_strategy_fx_strategy_pyx;
static PyObject *__pyx_n_s_trapeza_utils;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_kp_u_value_in_list_as_value_in__signa;
static PyObject *__pyx_kp_u_value_in_merged_positions_setter;
static PyObject *__pyx_kp_u_value_in_position_setter_dict;
static PyObject *__pyx_n_s_volume_data;
static PyObject *__pyx_n_u_volume_data;
static PyObject *__pyx_n_u_volume_data_key;
static PyObject *__pyx_n_u_volume_data_key_tuple_0;
static PyObject *__pyx_n_u_volume_data_key_tuple_1;
static PyObject *__pyx_n_u_volume_data_value;
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy__c_tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, PyObject *__pyx_v_suppress_ticking, PyObject *__pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_2c_init(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, bool __pyx_v_suppress_ticking, bool __pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_4_c_init_all_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_all_keys); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6_c_reset_storage(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_8c_reset(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10self_parse_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_12self_parse_signals(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14self_parse_merged_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_16self_parse_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18self_parse_merged_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_20self_parse_signals_at_step_t(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_22positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_positions); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_24signals_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_signals); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_26merged_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_positions); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_28total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_total_balances); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_30merged_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_total_balances); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_32_signals_at_step_t_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_34c_wrap_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, PyObject *__pyx_v_append_to_results); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_36c_add_signal(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, long __pyx_v_i, std::string __pyx_v_signal); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_38c_wrap_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_40__reduce_cython__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_42__setstate_cython__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_2name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_4name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_6accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_8accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_10accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_12lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_14lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_16lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_18suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_20suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_22suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_24strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_26strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_28strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_30tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_32tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_34tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_36strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_38strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_40strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_42tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_44tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_46tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_48_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_50_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_52_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_54_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_56_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_58_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_60positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_62positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_64positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_66merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_68merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_70merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_72total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_74total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_76total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_78merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_80merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_82merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_84signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_86signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_88signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_90_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_92_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_94_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_96_ignore_type_checking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_98__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, PyObject *__pyx_v_suppress_ticking, PyObject *__pyx_v_ignore_type_checking, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_100_check_parse_accounts(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_accounts); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_102_init_all_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_all_keys); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_104_reset_storage(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_106reset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_108_tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_110evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_frame, PyObject *__pyx_v_reference_currency, PyObject *__pyx_v_append_to_results); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_112add_signal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_acc, PyObject *__pyx_v_signal); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_114run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_price_data, PyObject *__pyx_v_reference_currency, PyObject *__pyx_v_volume_data); /* proto */
static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_2__pyx_unpickle_cFXStrategy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_7trapeza_8strategy_11fx_strategy_cFXStrategy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_50309536;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_codeobj__3;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__43;
static PyObject *__pyx_codeobj__45;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__57;
static PyObject *__pyx_codeobj__59;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__63;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__67;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__75;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__79;
static PyObject *__pyx_codeobj__81;
static PyObject *__pyx_codeobj__83;
static PyObject *__pyx_codeobj__85;
static PyObject *__pyx_codeobj__87;
static PyObject *__pyx_codeobj__89;
static PyObject *__pyx_codeobj__91;
static PyObject *__pyx_codeobj__93;
static PyObject *__pyx_codeobj__95;
static PyObject *__pyx_codeobj__97;
static PyObject *__pyx_codeobj__99;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__105;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__122;
/* Late includes */

/* "trapeza/strategy/fx_strategy.pyx":14
 * 
 * # noinspection PyProtectedMember,PyUnresolvedReferences
 * cpdef short _c_tick_method(self, dict data) except -1:             # <<<<<<<<<<<<<<
 *     """
 *     Default tick method. Ticks all contained FXAccounts (or derived BaseAccounts)
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_1_c_tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy__c_tick_method(PyObject *__pyx_v_self, PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {
  long __pyx_v_i;
  PyObject *__pyx_v_data_single_point = NULL;
  PyObject *__pyx_7genexpr__pyx_v_k = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_tick_method", 0);

  /* "trapeza/strategy/fx_strategy.pyx":29
 *     :return: 1
 *     """
 *     cdef long i = 0             # <<<<<<<<<<<<<<
 *     data_single_point = {k: data[k][-1] for k in data.keys()}
 *     for i in range(len(self.c_accounts)):
 */
  __pyx_v_i = 0;

  /* "trapeza/strategy/fx_strategy.pyx":30
 *     """
 *     cdef long i = 0
 *     data_single_point = {k: data[k][-1] for k in data.keys()}             # <<<<<<<<<<<<<<
 *     for i in range(len(self.c_accounts)):
 *         if hasattr(self.c_accounts[i], '_is_order_manager_monkey_patch'):
 */
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_data == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
      __PYX_ERR(0, 30, __pyx_L5_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_data, 1, __pyx_n_s_keys, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, NULL, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 30, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      if (unlikely(__pyx_v_data == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 30, __pyx_L5_error)
      }
      __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_data, __pyx_7genexpr__pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_6, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 30, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 30, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_v_data_single_point = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":31
 *     cdef long i = 0
 *     data_single_point = {k: data[k][-1] for k in data.keys()}
 *     for i in range(len(self.c_accounts)):             # <<<<<<<<<<<<<<
 *         if hasattr(self.c_accounts[i], '_is_order_manager_monkey_patch'):
 *             self.c_accounts[i].tick(data_single_point)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_4;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_3; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "trapeza/strategy/fx_strategy.pyx":32
 *     data_single_point = {k: data[k][-1] for k in data.keys()}
 *     for i in range(len(self.c_accounts)):
 *         if hasattr(self.c_accounts[i], '_is_order_manager_monkey_patch'):             # <<<<<<<<<<<<<<
 *             self.c_accounts[i].tick(data_single_point)
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_u_is_order_manager_monkey_patch); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 32, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__pyx_t_10 != 0);
    if (__pyx_t_11) {

      /* "trapeza/strategy/fx_strategy.pyx":33
 *     for i in range(len(self.c_accounts)):
 *         if hasattr(self.c_accounts[i], '_is_order_manager_monkey_patch'):
 *             self.c_accounts[i].tick(data_single_point)             # <<<<<<<<<<<<<<
 *         else:
 *             try:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tick); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_data_single_point) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_data_single_point);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":32
 *     data_single_point = {k: data[k][-1] for k in data.keys()}
 *     for i in range(len(self.c_accounts)):
 *         if hasattr(self.c_accounts[i], '_is_order_manager_monkey_patch'):             # <<<<<<<<<<<<<<
 *             self.c_accounts[i].tick(data_single_point)
 *         else:
 */
      goto __pyx_L11;
    }

    /* "trapeza/strategy/fx_strategy.pyx":35
 *             self.c_accounts[i].tick(data_single_point)
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)
 *             except AttributeError:
 */
    /*else*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "trapeza/strategy/fx_strategy.pyx":36
 *         else:
 *             try:
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 self.c_accounts[i].tick()
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_c_tick); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_8, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_c_clock); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "trapeza/strategy/fx_strategy.pyx":35
 *             self.c_accounts[i].tick(data_single_point)
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)
 *             except AttributeError:
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L19_try_end;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":37
 *             try:
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 self.c_accounts[i].tick()
 *     return 1
 */
        __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
        if (__pyx_t_5) {
          __Pyx_AddTraceback("trapeza.strategy.fx_strategy._c_tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(0, 37, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_6);

          /* "trapeza/strategy/fx_strategy.pyx":38
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)
 *             except AttributeError:
 *                 self.c_accounts[i].tick()             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 38, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_15, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 38, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_tick); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 38, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_16 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
            }
          }
          __pyx_t_8 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_15);
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L13_exception_handled;
        }
        goto __pyx_L14_except_error;
        __pyx_L14_except_error:;

        /* "trapeza/strategy/fx_strategy.pyx":35
 *             self.c_accounts[i].tick(data_single_point)
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.c_accounts[i].c_tick(self.c_accounts[i]._c_clock + 1)
 *             except AttributeError:
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        goto __pyx_L1_error;
        __pyx_L13_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        __pyx_L19_try_end:;
      }
    }
    __pyx_L11:;
  }

  /* "trapeza/strategy/fx_strategy.pyx":39
 *             except AttributeError:
 *                 self.c_accounts[i].tick()
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":14
 * 
 * # noinspection PyProtectedMember,PyUnresolvedReferences
 * cpdef short _c_tick_method(self, dict data) except -1:             # <<<<<<<<<<<<<<
 *     """
 *     Default tick method. Ticks all contained FXAccounts (or derived BaseAccounts)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy._c_tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data_single_point);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_1_c_tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy__c_tick_method[] = "\n    Default tick method. Ticks all contained FXAccounts (or derived BaseAccounts)\n    :param self: class object, placeholder\n    :param data: dict (see param:price_data at FXStrategy.run())\n                 keys: currency pair as tuple of strings: (currency_0, currency_1)\n                 values: list of floats as exchange rates per time step t or array of floats\n\n                 {(base, quote): [rate_0, rate_1, ..., rate_t],\n                  (base, quote): [rate_0, rate_1, ..., rate_t],\n                  ...}\n\n                 All values (list or array of floats) of all keys (currency pairs) have to be of same length.\n    :return: 1\n    ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_1_c_tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_c_tick_method (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_c_tick_method", 1, 2, 2, 1); __PYX_ERR(0, 14, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_c_tick_method") < 0)) __PYX_ERR(0, 14, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_c_tick_method", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 14, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy._c_tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyDict_Type), 1, "data", 1))) __PYX_ERR(0, 14, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy__c_tick_method(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy__c_tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_tick_method", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy__c_tick_method(__pyx_v_self, __pyx_v_data, 0); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 14, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy._c_tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":53
 *     directly by the user.
 *     """
 *     def __init__(self, string name, list accounts, object strategy_func, long lookback, object tick_func,             # <<<<<<<<<<<<<<
 *                  suppress_ticking, ignore_type_checking, dict strategy_kwargs, dict tick_kwargs):
 *         """
 */

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__[] = "\n        Calls self.c_init. See self.c_init for further docstring information.\n        :param name: std:string\n        :param accounts: list of FXAccount (or any other class derived from BaseAccount) class objects\n        :param strategy_func: Python function\n        :param lookback: long\n        :param tick_func: Python function, see FXStrategy docstring regarding call signature\n        :param suppress_ticking: py_bool\n        :param ignore_type_checking: py_bool\n        :param strategy_kwargs: dict for additional kwargs for param:strategy_func\n        :param tick_kwargs: dict for additional kwargs for param:tick_func\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__;
#endif
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  std::string __pyx_v_name;
  PyObject *__pyx_v_accounts = 0;
  PyObject *__pyx_v_strategy_func = 0;
  long __pyx_v_lookback;
  PyObject *__pyx_v_tick_func = 0;
  PyObject *__pyx_v_suppress_ticking = 0;
  PyObject *__pyx_v_ignore_type_checking = 0;
  PyObject *__pyx_v_strategy_kwargs = 0;
  PyObject *__pyx_v_tick_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_accounts,&__pyx_n_s_strategy_func,&__pyx_n_s_lookback,&__pyx_n_s_tick_func,&__pyx_n_s_suppress_ticking,&__pyx_n_s_ignore_type_checking,&__pyx_n_s_strategy_kwargs,&__pyx_n_s_tick_kwargs,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_accounts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 1); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strategy_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 2); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lookback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 3); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 4); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_suppress_ticking)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 5); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_type_checking)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 6); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strategy_kwargs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 7); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_kwargs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 8); __PYX_ERR(0, 53, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 53, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_name = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
    __pyx_v_accounts = ((PyObject*)values[1]);
    __pyx_v_strategy_func = values[2];
    __pyx_v_lookback = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_lookback == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
    __pyx_v_tick_func = values[4];
    __pyx_v_suppress_ticking = values[5];
    __pyx_v_ignore_type_checking = values[6];
    __pyx_v_strategy_kwargs = ((PyObject*)values[7]);
    __pyx_v_tick_kwargs = ((PyObject*)values[8]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 53, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_accounts), (&PyList_Type), 1, "accounts", 1))) __PYX_ERR(0, 53, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strategy_kwargs), (&PyDict_Type), 1, "strategy_kwargs", 1))) __PYX_ERR(0, 54, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tick_kwargs), (&PyDict_Type), 1, "tick_kwargs", 1))) __PYX_ERR(0, 54, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), __pyx_v_name, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_v_lookback, __pyx_v_tick_func, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, PyObject *__pyx_v_suppress_ticking, PyObject *__pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  bool __pyx_t_2;
  short __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "trapeza/strategy/fx_strategy.pyx":67
 *         :param tick_kwargs: dict for additional kwargs for param:tick_func
 *         """
 *         self.c_init(name, accounts, strategy_func, lookback, tick_func, suppress_ticking, ignore_type_checking,             # <<<<<<<<<<<<<<
 *                     strategy_kwargs, tick_kwargs)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_ticking); if (unlikely((__pyx_t_1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_type_checking); if (unlikely((__pyx_t_2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":68
 *         """
 *         self.c_init(name, accounts, strategy_func, lookback, tick_func, suppress_ticking, ignore_type_checking,
 *                     strategy_kwargs, tick_kwargs)             # <<<<<<<<<<<<<<
 * 
 *     # noinspection PyAttributeOutsideInit
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->c_init(__pyx_v_self, __pyx_v_name, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_v_lookback, __pyx_v_tick_func, __pyx_t_1, __pyx_t_2, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs, 0); if (unlikely(__pyx_t_3 == ((short)-1))) __PYX_ERR(0, 67, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":53
 *     directly by the user.
 *     """
 *     def __init__(self, string name, list accounts, object strategy_func, long lookback, object tick_func,             # <<<<<<<<<<<<<<
 *                  suppress_ticking, ignore_type_checking, dict strategy_kwargs, dict tick_kwargs):
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":72
 *     # noinspection PyAttributeOutsideInit
 *     @cython.wraparound(False)
 *     cpdef short c_init(self, string name, list accounts, object strategy_func, long lookback, object tick_func,             # <<<<<<<<<<<<<<
 *                        bool_t suppress_ticking, bool_t ignore_type_checking, dict strategy_kwargs,
 *                        dict tick_kwargs) except -1:
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_3c_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_init(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, bool __pyx_v_suppress_ticking, bool __pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs, int __pyx_skip_dispatch) {
  PyObject *__pyx_8genexpr1__pyx_v_acc = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_k = NULL;
  double __pyx_8genexpr2__pyx_v_v;
  PyObject *__pyx_8genexpr3__pyx_v_acc = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  short __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  double __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_init", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_3c_init)) {
        __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_lookback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_suppress_ticking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1; __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[10] = {__pyx_t_8, __pyx_t_3, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_t_4, __pyx_v_tick_func, __pyx_t_5, __pyx_t_6, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 9+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[10] = {__pyx_t_8, __pyx_t_3, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_t_4, __pyx_v_tick_func, __pyx_t_5, __pyx_t_6, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 9+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(9+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
          __Pyx_INCREF(__pyx_v_accounts);
          __Pyx_GIVEREF(__pyx_v_accounts);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_accounts);
          __Pyx_INCREF(__pyx_v_strategy_func);
          __Pyx_GIVEREF(__pyx_v_strategy_func);
          PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_strategy_func);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_4);
          __Pyx_INCREF(__pyx_v_tick_func);
          __Pyx_GIVEREF(__pyx_v_tick_func);
          PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_v_tick_func);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_9, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_10, 6+__pyx_t_9, __pyx_t_6);
          __Pyx_INCREF(__pyx_v_strategy_kwargs);
          __Pyx_GIVEREF(__pyx_v_strategy_kwargs);
          PyTuple_SET_ITEM(__pyx_t_10, 7+__pyx_t_9, __pyx_v_strategy_kwargs);
          __Pyx_INCREF(__pyx_v_tick_kwargs);
          __Pyx_GIVEREF(__pyx_v_tick_kwargs);
          PyTuple_SET_ITEM(__pyx_t_10, 8+__pyx_t_9, __pyx_v_tick_kwargs);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_5 = 0;
          __pyx_t_6 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_11 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":89
 *         :return: 1
 *         """
 *         self.c_name = name             # <<<<<<<<<<<<<<
 *         self._c_ignore_type_checking = ignore_type_checking
 *         self.c_accounts = accounts
 */
  __pyx_v_self->c_name = __pyx_v_name;

  /* "trapeza/strategy/fx_strategy.pyx":90
 *         """
 *         self.c_name = name
 *         self._c_ignore_type_checking = ignore_type_checking             # <<<<<<<<<<<<<<
 *         self.c_accounts = accounts
 *         cdef str k
 */
  __pyx_v_self->_c_ignore_type_checking = __pyx_v_ignore_type_checking;

  /* "trapeza/strategy/fx_strategy.pyx":91
 *         self.c_name = name
 *         self._c_ignore_type_checking = ignore_type_checking
 *         self.c_accounts = accounts             # <<<<<<<<<<<<<<
 *         cdef str k
 *         cdef double v
 */
  __Pyx_INCREF(__pyx_v_accounts);
  __Pyx_GIVEREF(__pyx_v_accounts);
  __Pyx_GOTREF(__pyx_v_self->c_accounts);
  __Pyx_DECREF(__pyx_v_self->c_accounts);
  __pyx_v_self->c_accounts = __pyx_v_accounts;

  /* "trapeza/strategy/fx_strategy.pyx":94
 *         cdef str k
 *         cdef double v
 *         self._c_init_accs_depots = [{k: v for k, v in acc.depot.items()} for acc in self.c_accounts]    # python only             # <<<<<<<<<<<<<<
 *         self._c_accs_clocks = [acc.clock for acc in self.accounts]  # python only content
 *         self.c_strategy_func = strategy_func
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 94, __pyx_L5_error)
    }
    __pyx_t_2 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
    for (;;) {
      if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_7); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L5_error)
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_acc, __pyx_t_7);
      __pyx_t_7 = 0;
      { /* enter inner scope */
        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_13 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr1__pyx_v_acc, __pyx_n_s_depot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (unlikely(__pyx_t_6 == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
          __PYX_ERR(0, 94, __pyx_L10_error)
        }
        __pyx_t_5 = __Pyx_dict_iterator(__pyx_t_6, 0, __pyx_n_s_items, (&__pyx_t_14), (&__pyx_t_9)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_10);
        __pyx_t_10 = __pyx_t_5;
        __pyx_t_5 = 0;
        while (1) {
          __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_14, &__pyx_t_13, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_9);
          if (unlikely(__pyx_t_15 == 0)) break;
          if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 94, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_6);
          if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 94, __pyx_L10_error)
          __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_k, ((PyObject*)__pyx_t_5));
          __pyx_t_5 = 0;
          __pyx_8genexpr2__pyx_v_v = __pyx_t_16;
          __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr2__pyx_v_v); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(PyDict_SetItem(__pyx_t_7, (PyObject*)__pyx_8genexpr2__pyx_v_k, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 94, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k); __pyx_8genexpr2__pyx_v_k = 0;
        goto __pyx_L13_exit_scope;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k); __pyx_8genexpr2__pyx_v_k = 0;
        goto __pyx_L5_error;
        __pyx_L13_exit_scope:;
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 94, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_acc); __pyx_8genexpr1__pyx_v_acc = 0;
    goto __pyx_L14_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_acc); __pyx_8genexpr1__pyx_v_acc = 0;
    goto __pyx_L1_error;
    __pyx_L14_exit_scope:;
  } /* exit inner scope */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_c_init_accs_depots);
  __Pyx_DECREF(__pyx_v_self->_c_init_accs_depots);
  __pyx_v_self->_c_init_accs_depots = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":95
 *         cdef double v
 *         self._c_init_accs_depots = [{k: v for k, v in acc.depot.items()} for acc in self.c_accounts]    # python only
 *         self._c_accs_clocks = [acc.clock for acc in self.accounts]  # python only content             # <<<<<<<<<<<<<<
 *         self.c_strategy_func = strategy_func
 *         self.c_tick_method = tick_func
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_7 = __pyx_t_2; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0;
      __pyx_t_17 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L17_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_17)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 95, __pyx_L17_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 95, __pyx_L17_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_17(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 95, __pyx_L17_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_acc, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_acc, __pyx_n_s_clock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 95, __pyx_L17_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_acc); __pyx_8genexpr3__pyx_v_acc = 0;
    goto __pyx_L20_exit_scope;
    __pyx_L17_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_acc); __pyx_8genexpr3__pyx_v_acc = 0;
    goto __pyx_L1_error;
    __pyx_L20_exit_scope:;
  } /* exit inner scope */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_c_accs_clocks);
  __Pyx_DECREF(__pyx_v_self->_c_accs_clocks);
  __pyx_v_self->_c_accs_clocks = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":96
 *         self._c_init_accs_depots = [{k: v for k, v in acc.depot.items()} for acc in self.c_accounts]    # python only
 *         self._c_accs_clocks = [acc.clock for acc in self.accounts]  # python only content
 *         self.c_strategy_func = strategy_func             # <<<<<<<<<<<<<<
 *         self.c_tick_method = tick_func
 *         self.c_lookback = lookback
 */
  __Pyx_INCREF(__pyx_v_strategy_func);
  __Pyx_GIVEREF(__pyx_v_strategy_func);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_func);
  __Pyx_DECREF(__pyx_v_self->c_strategy_func);
  __pyx_v_self->c_strategy_func = __pyx_v_strategy_func;

  /* "trapeza/strategy/fx_strategy.pyx":97
 *         self._c_accs_clocks = [acc.clock for acc in self.accounts]  # python only content
 *         self.c_strategy_func = strategy_func
 *         self.c_tick_method = tick_func             # <<<<<<<<<<<<<<
 *         self.c_lookback = lookback
 *         self.c_suppress_ticking = suppress_ticking
 */
  __Pyx_INCREF(__pyx_v_tick_func);
  __Pyx_GIVEREF(__pyx_v_tick_func);
  __Pyx_GOTREF(__pyx_v_self->c_tick_method);
  __Pyx_DECREF(__pyx_v_self->c_tick_method);
  __pyx_v_self->c_tick_method = __pyx_v_tick_func;

  /* "trapeza/strategy/fx_strategy.pyx":98
 *         self.c_strategy_func = strategy_func
 *         self.c_tick_method = tick_func
 *         self.c_lookback = lookback             # <<<<<<<<<<<<<<
 *         self.c_suppress_ticking = suppress_ticking
 *         self.c_strategy_kwargs = strategy_kwargs    # python only content
 */
  __pyx_v_self->c_lookback = __pyx_v_lookback;

  /* "trapeza/strategy/fx_strategy.pyx":99
 *         self.c_tick_method = tick_func
 *         self.c_lookback = lookback
 *         self.c_suppress_ticking = suppress_ticking             # <<<<<<<<<<<<<<
 *         self.c_strategy_kwargs = strategy_kwargs    # python only content
 *         self.c_tick_kwargs = tick_kwargs            # python only content
 */
  __pyx_v_self->c_suppress_ticking = __pyx_v_suppress_ticking;

  /* "trapeza/strategy/fx_strategy.pyx":100
 *         self.c_lookback = lookback
 *         self.c_suppress_ticking = suppress_ticking
 *         self.c_strategy_kwargs = strategy_kwargs    # python only content             # <<<<<<<<<<<<<<
 *         self.c_tick_kwargs = tick_kwargs            # python only content
 *         # c_signals, c_positions, c_merged_positions, c_total_balances, c_merged_total_balances and
 */
  __Pyx_INCREF(__pyx_v_strategy_kwargs);
  __Pyx_GIVEREF(__pyx_v_strategy_kwargs);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_strategy_kwargs);
  __pyx_v_self->c_strategy_kwargs = __pyx_v_strategy_kwargs;

  /* "trapeza/strategy/fx_strategy.pyx":101
 *         self.c_suppress_ticking = suppress_ticking
 *         self.c_strategy_kwargs = strategy_kwargs    # python only content
 *         self.c_tick_kwargs = tick_kwargs            # python only content             # <<<<<<<<<<<<<<
 *         # c_signals, c_positions, c_merged_positions, c_total_balances, c_merged_total_balances and
 *         # _c_signals_at_step_t should be initialized empty by default in cython
 */
  __Pyx_INCREF(__pyx_v_tick_kwargs);
  __Pyx_GIVEREF(__pyx_v_tick_kwargs);
  __Pyx_GOTREF(__pyx_v_self->c_tick_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_tick_kwargs);
  __pyx_v_self->c_tick_kwargs = __pyx_v_tick_kwargs;

  /* "trapeza/strategy/fx_strategy.pyx":104
 *         # c_signals, c_positions, c_merged_positions, c_total_balances, c_merged_total_balances and
 *         # _c_signals_at_step_t should be initialized empty by default in cython
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":72
 *     # noinspection PyAttributeOutsideInit
 *     @cython.wraparound(False)
 *     cpdef short c_init(self, string name, list accounts, object strategy_func, long lookback, object tick_func,             # <<<<<<<<<<<<<<
 *                        bool_t suppress_ticking, bool_t ignore_type_checking, dict strategy_kwargs,
 *                        dict tick_kwargs) except -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_acc);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_acc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_3c_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_2c_init[] = "\n        This method gets wrapped by __init__, which is useful when __init__ gets overwritten during subclassing.\n        :param name: std:string\n        :param accounts: list of FXAccount (or any other class derived from BaseAccount) class objects\n        :param strategy_func: Python function containing the trading strategy\n        :param lookback: long\n        :param tick_func: Python function containing alternative tick method for FXAccount (or any other class derived \n                                 from BaseAccount), see FXStrategy docstring regarding call signature\n        :param suppress_ticking: std:bool, see docstring of FXStrategy\n        :param ignore_type_checking: std:bool, whether to ignore type checks (more performance, less safe)\n        :param strategy_kwargs: dict for additional kwargs for param:strategy_func\n        :param tick_kwargs: dict for additional kwargs for param:tick_func\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_3c_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  std::string __pyx_v_name;
  PyObject *__pyx_v_accounts = 0;
  PyObject *__pyx_v_strategy_func = 0;
  long __pyx_v_lookback;
  PyObject *__pyx_v_tick_func = 0;
  bool __pyx_v_suppress_ticking;
  bool __pyx_v_ignore_type_checking;
  PyObject *__pyx_v_strategy_kwargs = 0;
  PyObject *__pyx_v_tick_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_init (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_accounts,&__pyx_n_s_strategy_func,&__pyx_n_s_lookback,&__pyx_n_s_tick_func,&__pyx_n_s_suppress_ticking,&__pyx_n_s_ignore_type_checking,&__pyx_n_s_strategy_kwargs,&__pyx_n_s_tick_kwargs,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_accounts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 1); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strategy_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 2); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lookback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 3); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 4); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_suppress_ticking)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 5); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_type_checking)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 6); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strategy_kwargs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 7); __PYX_ERR(0, 72, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_kwargs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, 8); __PYX_ERR(0, 72, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_init") < 0)) __PYX_ERR(0, 72, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_name = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error)
    __pyx_v_accounts = ((PyObject*)values[1]);
    __pyx_v_strategy_func = values[2];
    __pyx_v_lookback = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_lookback == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error)
    __pyx_v_tick_func = values[4];
    __pyx_v_suppress_ticking = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_suppress_ticking == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error)
    __pyx_v_ignore_type_checking = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_ignore_type_checking == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error)
    __pyx_v_strategy_kwargs = ((PyObject*)values[7]);
    __pyx_v_tick_kwargs = ((PyObject*)values[8]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("c_init", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 72, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_accounts), (&PyList_Type), 1, "accounts", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strategy_kwargs), (&PyDict_Type), 1, "strategy_kwargs", 1))) __PYX_ERR(0, 73, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tick_kwargs), (&PyDict_Type), 1, "tick_kwargs", 1))) __PYX_ERR(0, 74, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_2c_init(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), __pyx_v_name, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_v_lookback, __pyx_v_tick_func, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_2c_init(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::string __pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, bool __pyx_v_suppress_ticking, bool __pyx_v_ignore_type_checking, PyObject *__pyx_v_strategy_kwargs, PyObject *__pyx_v_tick_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_init", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_init(__pyx_v_self, __pyx_v_name, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_v_lookback, __pyx_v_tick_func, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 72, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":108
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short _c_init_all_positions(self, list all_keys) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Set internal storage of self.c_positions and self.c_merged_positions to empty vectors.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_5_c_init_all_positions(PyObject *__pyx_v_self, PyObject *__pyx_v_all_keys); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_all_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_all_keys, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_key = 0;
  std::vector<double>  __pyx_v_vec;
  std::vector<std::vector<double> >  __pyx_v_vec_vec;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  std::string __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_init_all_positions", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_init_all_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_5_c_init_all_positions)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_all_keys) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_all_keys);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":118
 *         cdef vector[double] vec
 *         cdef vector[vector[double]] vec_vec
 *         for key in set(itertools.chain(*all_keys)):             # <<<<<<<<<<<<<<
 *             self.c_positions[key.encode()] = vec_vec
 *             self.c_merged_positions[key.encode()] = vec
 */
  __pyx_t_6 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_itertools); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_chain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySequence_Tuple(__pyx_v_all_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySet_New(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_set_iterator(__pyx_t_2, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_6, &__pyx_t_4, __pyx_t_8);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":119
 *         cdef vector[vector[double]] vec_vec
 *         for key in set(itertools.chain(*all_keys)):
 *             self.c_positions[key.encode()] = vec_vec             # <<<<<<<<<<<<<<
 *             self.c_merged_positions[key.encode()] = vec
 *         return 1
 */
    if (unlikely(__pyx_v_key == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(0, 119, __pyx_L1_error)
    }
    __pyx_t_4 = PyUnicode_AsEncodedString(__pyx_v_key, NULL, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_self->c_positions[__pyx_t_10]) = __pyx_v_vec_vec;

    /* "trapeza/strategy/fx_strategy.pyx":120
 *         for key in set(itertools.chain(*all_keys)):
 *             self.c_positions[key.encode()] = vec_vec
 *             self.c_merged_positions[key.encode()] = vec             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    if (unlikely(__pyx_v_key == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(0, 120, __pyx_L1_error)
    }
    __pyx_t_4 = PyUnicode_AsEncodedString(__pyx_v_key, NULL, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_self->c_merged_positions[__pyx_t_10]) = __pyx_v_vec;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":121
 *             self.c_positions[key.encode()] = vec_vec
 *             self.c_merged_positions[key.encode()] = vec
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef short _c_reset_storage(self) except -1:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":108
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short _c_init_all_positions(self, list all_keys) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Set internal storage of self.c_positions and self.c_merged_positions to empty vectors.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_init_all_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_5_c_init_all_positions(PyObject *__pyx_v_self, PyObject *__pyx_v_all_keys); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_4_c_init_all_positions[] = "\n        Set internal storage of self.c_positions and self.c_merged_positions to empty vectors.\n        :param all_keys: list (or generator) of of all tuple keys contained in exchange_rates'/ price_data's dictionary\n                         tuple keys: (py_str:base, py_str:quote)\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_5_c_init_all_positions(PyObject *__pyx_v_self, PyObject *__pyx_v_all_keys) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_c_init_all_positions (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_all_keys), (&PyList_Type), 1, "all_keys", 1))) __PYX_ERR(0, 108, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_4_c_init_all_positions(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_all_keys));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_4_c_init_all_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_all_keys) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_init_all_positions", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_all_positions(__pyx_v_self, __pyx_v_all_keys, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 108, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_init_all_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":123
 *         return 1
 * 
 *     cpdef short _c_reset_storage(self) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Clears all internal storages (vectors and unordered_maps), which keep track of strategy results.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_7_c_reset_storage(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_reset_storage(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_reset_storage", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_reset_storage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_7_c_reset_storage)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":128
 *         :return: 1
 *         """
 *         self.c_signals.clear()             # <<<<<<<<<<<<<<
 *         self.c_positions.clear()
 *         self.c_merged_positions.clear()
 */
  __pyx_v_self->c_signals.clear();

  /* "trapeza/strategy/fx_strategy.pyx":129
 *         """
 *         self.c_signals.clear()
 *         self.c_positions.clear()             # <<<<<<<<<<<<<<
 *         self.c_merged_positions.clear()
 *         self.c_total_balances.clear()
 */
  __pyx_v_self->c_positions.clear();

  /* "trapeza/strategy/fx_strategy.pyx":130
 *         self.c_signals.clear()
 *         self.c_positions.clear()
 *         self.c_merged_positions.clear()             # <<<<<<<<<<<<<<
 *         self.c_total_balances.clear()
 *         self.c_merged_total_balances.clear()
 */
  __pyx_v_self->c_merged_positions.clear();

  /* "trapeza/strategy/fx_strategy.pyx":131
 *         self.c_positions.clear()
 *         self.c_merged_positions.clear()
 *         self.c_total_balances.clear()             # <<<<<<<<<<<<<<
 *         self.c_merged_total_balances.clear()
 *         self._c_signals_at_step_t.clear()
 */
  __pyx_v_self->c_total_balances.clear();

  /* "trapeza/strategy/fx_strategy.pyx":132
 *         self.c_merged_positions.clear()
 *         self.c_total_balances.clear()
 *         self.c_merged_total_balances.clear()             # <<<<<<<<<<<<<<
 *         self._c_signals_at_step_t.clear()
 *         return 1
 */
  __pyx_v_self->c_merged_total_balances.clear();

  /* "trapeza/strategy/fx_strategy.pyx":133
 *         self.c_total_balances.clear()
 *         self.c_merged_total_balances.clear()
 *         self._c_signals_at_step_t.clear()             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  __pyx_v_self->_c_signals_at_step_t.clear();

  /* "trapeza/strategy/fx_strategy.pyx":134
 *         self.c_merged_total_balances.clear()
 *         self._c_signals_at_step_t.clear()
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     # noinspection PyProtectedMember
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":123
 *         return 1
 * 
 *     cpdef short _c_reset_storage(self) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Clears all internal storages (vectors and unordered_maps), which keep track of strategy results.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_reset_storage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_7_c_reset_storage(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6_c_reset_storage[] = "\n        Clears all internal storages (vectors and unordered_maps), which keep track of strategy results.\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_7_c_reset_storage(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_c_reset_storage (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6_c_reset_storage(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6_c_reset_storage(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_c_reset_storage", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_reset_storage(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 123, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_reset_storage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":139
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short c_reset(self) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage and depots as well as clocks of all contained FXAccounts (or derived BaseAccounts).
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_9c_reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_reset(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  PyObject *__pyx_8genexpr4__pyx_v_k = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_v = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  long __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  long __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_reset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_9c_reset)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":144
 *         :return: 1
 *         """
 *         self._c_reset_storage()             # <<<<<<<<<<<<<<
 *         cdef long i = 0
 *         for i in range(len(self.c_accounts)):
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->_c_reset_storage(__pyx_v_self, 0); if (unlikely(__pyx_t_5 == ((short)-1))) __PYX_ERR(0, 144, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":145
 *         """
 *         self._c_reset_storage()
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         for i in range(len(self.c_accounts)):
 *             self.c_accounts[i]._reset()
 */
  __pyx_v_i = 0;

  /* "trapeza/strategy/fx_strategy.pyx":146
 *         self._c_reset_storage()
 *         cdef long i = 0
 *         for i in range(len(self.c_accounts)):             # <<<<<<<<<<<<<<
 *             self.c_accounts[i]._reset()
 * 
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 146, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "trapeza/strategy/fx_strategy.pyx":147
 *         cdef long i = 0
 *         for i in range(len(self.c_accounts)):
 *             self.c_accounts[i]._reset()             # <<<<<<<<<<<<<<
 * 
 *             # avoid copying just object ref
 */
    if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 147, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->c_accounts, __pyx_v_i), __pyx_n_s_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":150
 * 
 *             # avoid copying just object ref
 *             self.c_accounts[i].depot = {k: float(v) for k, v in self._init_accs_depots[i].items()}             # <<<<<<<<<<<<<<
 * 
 *             self.c_accounts[i].clock = <long>self._c_accs_clocks[i]
 */
    { /* enter inner scope */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_accs_depots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__pyx_t_4 == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 150, __pyx_L7_error)
      }
      __pyx_t_3 = __Pyx_dict_iterator(__pyx_t_4, 0, __pyx_n_s_items, (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_3;
      __pyx_t_3 = 0;
      while (1) {
        __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_10, &__pyx_t_9, &__pyx_t_3, &__pyx_t_4, NULL, __pyx_t_11);
        if (unlikely(__pyx_t_12 == 0)) break;
        if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 150, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_k, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_v, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyNumber_Float(__pyx_8genexpr4__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr4__pyx_v_k, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 150, __pyx_L7_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_k); __pyx_8genexpr4__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_v); __pyx_8genexpr4__pyx_v_v = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_k); __pyx_8genexpr4__pyx_v_k = 0;
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_v); __pyx_8genexpr4__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 150, __pyx_L1_error)
    }
    if (__Pyx_PyObject_SetAttrStr(PyList_GET_ITEM(__pyx_v_self->c_accounts, __pyx_v_i), __pyx_n_s_depot, __pyx_t_1) < 0) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":152
 *             self.c_accounts[i].depot = {k: float(v) for k, v in self._init_accs_depots[i].items()}
 * 
 *             self.c_accounts[i].clock = <long>self._c_accs_clocks[i]             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    if (unlikely(__pyx_v_self->_c_accs_clocks == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 152, __pyx_L1_error)
    }
    __pyx_t_13 = __Pyx_PyInt_As_long(PyList_GET_ITEM(__pyx_v_self->_c_accs_clocks, __pyx_v_i)); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyInt_From_long(((long)__pyx_t_13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 152, __pyx_L1_error)
    }
    if (__Pyx_PyObject_SetAttrStr(PyList_GET_ITEM(__pyx_v_self->c_accounts, __pyx_v_i), __pyx_n_s_clock, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "trapeza/strategy/fx_strategy.pyx":153
 * 
 *             self.c_accounts[i].clock = <long>self._c_accs_clocks[i]
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":139
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short c_reset(self) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage and depots as well as clocks of all contained FXAccounts (or derived BaseAccounts).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_v);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_9c_reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_8c_reset[] = "\n        Resets internal storage and depots as well as clocks of all contained FXAccounts (or derived BaseAccounts).\n        :return: 1 \n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_9c_reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_reset (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_8c_reset(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_8c_reset(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_reset(__pyx_v_self, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":157
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef dict parse_positions(self, unordered_map[string, vector[vector[double]]] positions):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (positions) to Python dict.
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_positions(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_v_positions) {
  PyObject *__pyx_v_ret_positions = 0;
  PyObject *__pyx_v_ret_outer_pos = 0;
  PyObject *__pyx_v_ret_inner_pos = 0;
  std::pair<std::string,std::vector<std::vector<double> > >  __pyx_v_elem;
  std::vector<double>  __pyx_v_outer_pos;
  double __pyx_v_inner_pos;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::unordered_map<std::string,std::vector<std::vector<double> > > ::iterator __pyx_t_2;
  std::pair<std::string,std::vector<std::vector<double> > >  __pyx_t_3;
  std::vector<std::vector<double> > ::iterator __pyx_t_4;
  std::vector<std::vector<double> >  *__pyx_t_5;
  std::vector<double>  __pyx_t_6;
  std::vector<double> ::iterator __pyx_t_7;
  double __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":165
 *                  value: list of floats representing position sizes at every time step which FXStrategy has run through
 *         """
 *         cdef dict ret_positions = {}             # <<<<<<<<<<<<<<
 *         cdef list ret_outer_pos, ret_inner_pos
 *         for elem in positions:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_positions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":167
 *         cdef dict ret_positions = {}
 *         cdef list ret_outer_pos, ret_inner_pos
 *         for elem in positions:             # <<<<<<<<<<<<<<
 *             ret_outer_pos = []
 *             for outer_pos in elem.second:
 */
  __pyx_t_2 = __pyx_v_positions.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_positions.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_elem = __pyx_t_3;

    /* "trapeza/strategy/fx_strategy.pyx":168
 *         cdef list ret_outer_pos, ret_inner_pos
 *         for elem in positions:
 *             ret_outer_pos = []             # <<<<<<<<<<<<<<
 *             for outer_pos in elem.second:
 *                 ret_inner_pos = []
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_outer_pos, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":169
 *         for elem in positions:
 *             ret_outer_pos = []
 *             for outer_pos in elem.second:             # <<<<<<<<<<<<<<
 *                 ret_inner_pos = []
 *                 for inner_pos in outer_pos:
 */
    __pyx_t_5 = &__pyx_v_elem.second;
    __pyx_t_4 = __pyx_t_5->begin();
    for (;;) {
      if (!(__pyx_t_4 != __pyx_t_5->end())) break;
      __pyx_t_6 = *__pyx_t_4;
      ++__pyx_t_4;
      __pyx_v_outer_pos = __pyx_t_6;

      /* "trapeza/strategy/fx_strategy.pyx":170
 *             ret_outer_pos = []
 *             for outer_pos in elem.second:
 *                 ret_inner_pos = []             # <<<<<<<<<<<<<<
 *                 for inner_pos in outer_pos:
 *                     ret_inner_pos.append(inner_pos)
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_ret_inner_pos, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":171
 *             for outer_pos in elem.second:
 *                 ret_inner_pos = []
 *                 for inner_pos in outer_pos:             # <<<<<<<<<<<<<<
 *                     ret_inner_pos.append(inner_pos)
 *                 ret_outer_pos.append(ret_inner_pos)
 */
      __pyx_t_7 = __pyx_v_outer_pos.begin();
      for (;;) {
        if (!(__pyx_t_7 != __pyx_v_outer_pos.end())) break;
        __pyx_t_8 = *__pyx_t_7;
        ++__pyx_t_7;
        __pyx_v_inner_pos = __pyx_t_8;

        /* "trapeza/strategy/fx_strategy.pyx":172
 *                 ret_inner_pos = []
 *                 for inner_pos in outer_pos:
 *                     ret_inner_pos.append(inner_pos)             # <<<<<<<<<<<<<<
 *                 ret_outer_pos.append(ret_inner_pos)
 *             ret_positions[elem.first.decode()] = ret_outer_pos
 */
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_inner_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_ret_inner_pos, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 172, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":171
 *             for outer_pos in elem.second:
 *                 ret_inner_pos = []
 *                 for inner_pos in outer_pos:             # <<<<<<<<<<<<<<
 *                     ret_inner_pos.append(inner_pos)
 *                 ret_outer_pos.append(ret_inner_pos)
 */
      }

      /* "trapeza/strategy/fx_strategy.pyx":173
 *                 for inner_pos in outer_pos:
 *                     ret_inner_pos.append(inner_pos)
 *                 ret_outer_pos.append(ret_inner_pos)             # <<<<<<<<<<<<<<
 *             ret_positions[elem.first.decode()] = ret_outer_pos
 *         return ret_positions
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_ret_outer_pos, __pyx_v_ret_inner_pos); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 173, __pyx_L1_error)

      /* "trapeza/strategy/fx_strategy.pyx":169
 *         for elem in positions:
 *             ret_outer_pos = []
 *             for outer_pos in elem.second:             # <<<<<<<<<<<<<<
 *                 ret_inner_pos = []
 *                 for inner_pos in outer_pos:
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":174
 *                     ret_inner_pos.append(inner_pos)
 *                 ret_outer_pos.append(ret_inner_pos)
 *             ret_positions[elem.first.decode()] = ret_outer_pos             # <<<<<<<<<<<<<<
 *         return ret_positions
 * 
 */
    __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_elem.first, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_ret_positions, __pyx_t_1, __pyx_v_ret_outer_pos) < 0)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":167
 *         cdef dict ret_positions = {}
 *         cdef list ret_outer_pos, ret_inner_pos
 *         for elem in positions:             # <<<<<<<<<<<<<<
 *             ret_outer_pos = []
 *             for outer_pos in elem.second:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":175
 *                 ret_outer_pos.append(ret_inner_pos)
 *             ret_positions[elem.first.decode()] = ret_outer_pos
 *         return ret_positions             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_positions);
  __pyx_r = __pyx_v_ret_positions;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":157
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef dict parse_positions(self, unordered_map[string, vector[vector[double]]] positions):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (positions) to Python dict.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.parse_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_positions);
  __Pyx_XDECREF(__pyx_v_ret_outer_pos);
  __Pyx_XDECREF(__pyx_v_ret_inner_pos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":179
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_signals(self, vector[vector[vector[string]]] signals):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (signals) to Python list.
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_signals(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<std::vector<std::vector<std::string> > >  __pyx_v_signals) {
  PyObject *__pyx_v_ret_signals = 0;
  PyObject *__pyx_v_ret_middle_signals = 0;
  PyObject *__pyx_v_ret_inner_signals = 0;
  std::vector<std::vector<std::string> >  __pyx_v_outer_signal;
  std::vector<std::string>  __pyx_v_middle_signal;
  std::string __pyx_v_inner_signal;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<std::vector<std::vector<std::string> > > ::iterator __pyx_t_2;
  std::vector<std::vector<std::string> >  __pyx_t_3;
  std::vector<std::vector<std::string> > ::iterator __pyx_t_4;
  std::vector<std::string>  __pyx_t_5;
  std::vector<std::string> ::iterator __pyx_t_6;
  std::string __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_signals", 0);

  /* "trapeza/strategy/fx_strategy.pyx":185
 *         :return: list, see docstring of FXStrategy class regarding self.signals for further details
 *         """
 *         cdef list ret_signals = []             # <<<<<<<<<<<<<<
 *         cdef list ret_middle_signals, ret_inner_signals
 *         for outer_signal in signals:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_signals = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":187
 *         cdef list ret_signals = []
 *         cdef list ret_middle_signals, ret_inner_signals
 *         for outer_signal in signals:             # <<<<<<<<<<<<<<
 *             ret_middle_signals = []
 *             for middle_signal in outer_signal:
 */
  __pyx_t_2 = __pyx_v_signals.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_signals.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_outer_signal = __pyx_t_3;

    /* "trapeza/strategy/fx_strategy.pyx":188
 *         cdef list ret_middle_signals, ret_inner_signals
 *         for outer_signal in signals:
 *             ret_middle_signals = []             # <<<<<<<<<<<<<<
 *             for middle_signal in outer_signal:
 *                 ret_inner_signals = []
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_middle_signals, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":189
 *         for outer_signal in signals:
 *             ret_middle_signals = []
 *             for middle_signal in outer_signal:             # <<<<<<<<<<<<<<
 *                 ret_inner_signals = []
 *                 for inner_signal in middle_signal:
 */
    __pyx_t_4 = __pyx_v_outer_signal.begin();
    for (;;) {
      if (!(__pyx_t_4 != __pyx_v_outer_signal.end())) break;
      __pyx_t_5 = *__pyx_t_4;
      ++__pyx_t_4;
      __pyx_v_middle_signal = __pyx_t_5;

      /* "trapeza/strategy/fx_strategy.pyx":190
 *             ret_middle_signals = []
 *             for middle_signal in outer_signal:
 *                 ret_inner_signals = []             # <<<<<<<<<<<<<<
 *                 for inner_signal in middle_signal:
 *                     ret_inner_signals.append(inner_signal.decode())
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_ret_inner_signals, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":191
 *             for middle_signal in outer_signal:
 *                 ret_inner_signals = []
 *                 for inner_signal in middle_signal:             # <<<<<<<<<<<<<<
 *                     ret_inner_signals.append(inner_signal.decode())
 *                 ret_middle_signals.append(ret_inner_signals)
 */
      __pyx_t_6 = __pyx_v_middle_signal.begin();
      for (;;) {
        if (!(__pyx_t_6 != __pyx_v_middle_signal.end())) break;
        __pyx_t_7 = *__pyx_t_6;
        ++__pyx_t_6;
        __pyx_v_inner_signal = __pyx_t_7;

        /* "trapeza/strategy/fx_strategy.pyx":192
 *                 ret_inner_signals = []
 *                 for inner_signal in middle_signal:
 *                     ret_inner_signals.append(inner_signal.decode())             # <<<<<<<<<<<<<<
 *                 ret_middle_signals.append(ret_inner_signals)
 *             ret_signals.append(ret_middle_signals)
 */
        __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_inner_signal, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ret_inner_signals, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":191
 *             for middle_signal in outer_signal:
 *                 ret_inner_signals = []
 *                 for inner_signal in middle_signal:             # <<<<<<<<<<<<<<
 *                     ret_inner_signals.append(inner_signal.decode())
 *                 ret_middle_signals.append(ret_inner_signals)
 */
      }

      /* "trapeza/strategy/fx_strategy.pyx":193
 *                 for inner_signal in middle_signal:
 *                     ret_inner_signals.append(inner_signal.decode())
 *                 ret_middle_signals.append(ret_inner_signals)             # <<<<<<<<<<<<<<
 *             ret_signals.append(ret_middle_signals)
 *         return ret_signals
 */
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ret_middle_signals, __pyx_v_ret_inner_signals); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 193, __pyx_L1_error)

      /* "trapeza/strategy/fx_strategy.pyx":189
 *         for outer_signal in signals:
 *             ret_middle_signals = []
 *             for middle_signal in outer_signal:             # <<<<<<<<<<<<<<
 *                 ret_inner_signals = []
 *                 for inner_signal in middle_signal:
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":194
 *                     ret_inner_signals.append(inner_signal.decode())
 *                 ret_middle_signals.append(ret_inner_signals)
 *             ret_signals.append(ret_middle_signals)             # <<<<<<<<<<<<<<
 *         return ret_signals
 * 
 */
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ret_signals, __pyx_v_ret_middle_signals); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 194, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":187
 *         cdef list ret_signals = []
 *         cdef list ret_middle_signals, ret_inner_signals
 *         for outer_signal in signals:             # <<<<<<<<<<<<<<
 *             ret_middle_signals = []
 *             for middle_signal in outer_signal:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":195
 *                 ret_middle_signals.append(ret_inner_signals)
 *             ret_signals.append(ret_middle_signals)
 *         return ret_signals             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_signals);
  __pyx_r = __pyx_v_ret_signals;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":179
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_signals(self, vector[vector[vector[string]]] signals):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (signals) to Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.parse_signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_signals);
  __Pyx_XDECREF(__pyx_v_ret_middle_signals);
  __Pyx_XDECREF(__pyx_v_ret_inner_signals);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":199
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef dict parse_merged_positions(self, unordered_map[string, vector[double]] merged_positions):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (merged_positions) to Python dict.
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_positions(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::unordered_map<std::string,std::vector<double> >  __pyx_v_merged_positions) {
  PyObject *__pyx_v_ret_merged_positions = 0;
  PyObject *__pyx_v_ret_inner_mp = 0;
  std::pair<std::string,std::vector<double> >  __pyx_v_elem_mp;
  double __pyx_v_db;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::unordered_map<std::string,std::vector<double> > ::iterator __pyx_t_2;
  std::pair<std::string,std::vector<double> >  __pyx_t_3;
  std::vector<double> ::iterator __pyx_t_4;
  std::vector<double>  *__pyx_t_5;
  double __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_merged_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":205
 *         :return: dict, see docstring of FXStrategy class regarding self.merged_positions for further details
 *         """
 *         cdef dict ret_merged_positions = {}             # <<<<<<<<<<<<<<
 *         cdef list ret_inner_mp
 *         for elem_mp in merged_positions:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_merged_positions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":207
 *         cdef dict ret_merged_positions = {}
 *         cdef list ret_inner_mp
 *         for elem_mp in merged_positions:             # <<<<<<<<<<<<<<
 *             ret_inner_mp = []
 *             for db in elem_mp.second:
 */
  __pyx_t_2 = __pyx_v_merged_positions.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_merged_positions.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_elem_mp = __pyx_t_3;

    /* "trapeza/strategy/fx_strategy.pyx":208
 *         cdef list ret_inner_mp
 *         for elem_mp in merged_positions:
 *             ret_inner_mp = []             # <<<<<<<<<<<<<<
 *             for db in elem_mp.second:
 *                 ret_inner_mp.append(db)
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_inner_mp, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":209
 *         for elem_mp in merged_positions:
 *             ret_inner_mp = []
 *             for db in elem_mp.second:             # <<<<<<<<<<<<<<
 *                 ret_inner_mp.append(db)
 *             ret_merged_positions[elem_mp.first.decode()] = ret_inner_mp
 */
    __pyx_t_5 = &__pyx_v_elem_mp.second;
    __pyx_t_4 = __pyx_t_5->begin();
    for (;;) {
      if (!(__pyx_t_4 != __pyx_t_5->end())) break;
      __pyx_t_6 = *__pyx_t_4;
      ++__pyx_t_4;
      __pyx_v_db = __pyx_t_6;

      /* "trapeza/strategy/fx_strategy.pyx":210
 *             ret_inner_mp = []
 *             for db in elem_mp.second:
 *                 ret_inner_mp.append(db)             # <<<<<<<<<<<<<<
 *             ret_merged_positions[elem_mp.first.decode()] = ret_inner_mp
 *         return ret_merged_positions
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_db); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ret_inner_mp, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":209
 *         for elem_mp in merged_positions:
 *             ret_inner_mp = []
 *             for db in elem_mp.second:             # <<<<<<<<<<<<<<
 *                 ret_inner_mp.append(db)
 *             ret_merged_positions[elem_mp.first.decode()] = ret_inner_mp
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":211
 *             for db in elem_mp.second:
 *                 ret_inner_mp.append(db)
 *             ret_merged_positions[elem_mp.first.decode()] = ret_inner_mp             # <<<<<<<<<<<<<<
 *         return ret_merged_positions
 * 
 */
    __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_elem_mp.first, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_ret_merged_positions, __pyx_t_1, __pyx_v_ret_inner_mp) < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":207
 *         cdef dict ret_merged_positions = {}
 *         cdef list ret_inner_mp
 *         for elem_mp in merged_positions:             # <<<<<<<<<<<<<<
 *             ret_inner_mp = []
 *             for db in elem_mp.second:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":212
 *                 ret_inner_mp.append(db)
 *             ret_merged_positions[elem_mp.first.decode()] = ret_inner_mp
 *         return ret_merged_positions             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_merged_positions);
  __pyx_r = __pyx_v_ret_merged_positions;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":199
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef dict parse_merged_positions(self, unordered_map[string, vector[double]] merged_positions):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (merged_positions) to Python dict.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.parse_merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_merged_positions);
  __Pyx_XDECREF(__pyx_v_ret_inner_mp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":216
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_total_balances(self, vector[vector[double]] total_balances):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (total_balances) to Python list.
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_total_balances(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<std::vector<double> >  __pyx_v_total_balances) {
  PyObject *__pyx_v_ret_total_balances = 0;
  PyObject *__pyx_v_ret_inner_tb = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exp = 0;
  std::vector<double>  __pyx_v_outer_tb;
  double __pyx_v_inner_tb;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<std::vector<double> > ::iterator __pyx_t_2;
  std::vector<double>  __pyx_t_3;
  std::vector<double> ::iterator __pyx_t_4;
  double __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":222
 *         :return: list, see docstring of FXStrategy class regarding self.total_balances for further details
 *         """
 *         cdef list ret_total_balances = []             # <<<<<<<<<<<<<<
 *         cdef list ret_inner_tb
 *         cdef list exp
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_total_balances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":225
 *         cdef list ret_inner_tb
 *         cdef list exp
 *         exp = total_balances             # <<<<<<<<<<<<<<
 *         for outer_tb in total_balances:
 *             ret_inner_tb = []
 */
  __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(__pyx_v_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 225, __pyx_L1_error)
  __pyx_v_exp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":226
 *         cdef list exp
 *         exp = total_balances
 *         for outer_tb in total_balances:             # <<<<<<<<<<<<<<
 *             ret_inner_tb = []
 *             for inner_tb in outer_tb:
 */
  __pyx_t_2 = __pyx_v_total_balances.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_total_balances.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_outer_tb = __pyx_t_3;

    /* "trapeza/strategy/fx_strategy.pyx":227
 *         exp = total_balances
 *         for outer_tb in total_balances:
 *             ret_inner_tb = []             # <<<<<<<<<<<<<<
 *             for inner_tb in outer_tb:
 *                 ret_inner_tb.append(inner_tb)
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_inner_tb, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":228
 *         for outer_tb in total_balances:
 *             ret_inner_tb = []
 *             for inner_tb in outer_tb:             # <<<<<<<<<<<<<<
 *                 ret_inner_tb.append(inner_tb)
 *             ret_total_balances.append(ret_inner_tb)
 */
    __pyx_t_4 = __pyx_v_outer_tb.begin();
    for (;;) {
      if (!(__pyx_t_4 != __pyx_v_outer_tb.end())) break;
      __pyx_t_5 = *__pyx_t_4;
      ++__pyx_t_4;
      __pyx_v_inner_tb = __pyx_t_5;

      /* "trapeza/strategy/fx_strategy.pyx":229
 *             ret_inner_tb = []
 *             for inner_tb in outer_tb:
 *                 ret_inner_tb.append(inner_tb)             # <<<<<<<<<<<<<<
 *             ret_total_balances.append(ret_inner_tb)
 *         return ret_total_balances
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_inner_tb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_ret_inner_tb, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 229, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":228
 *         for outer_tb in total_balances:
 *             ret_inner_tb = []
 *             for inner_tb in outer_tb:             # <<<<<<<<<<<<<<
 *                 ret_inner_tb.append(inner_tb)
 *             ret_total_balances.append(ret_inner_tb)
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":230
 *             for inner_tb in outer_tb:
 *                 ret_inner_tb.append(inner_tb)
 *             ret_total_balances.append(ret_inner_tb)             # <<<<<<<<<<<<<<
 *         return ret_total_balances
 * 
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_ret_total_balances, __pyx_v_ret_inner_tb); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 230, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":226
 *         cdef list exp
 *         exp = total_balances
 *         for outer_tb in total_balances:             # <<<<<<<<<<<<<<
 *             ret_inner_tb = []
 *             for inner_tb in outer_tb:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":231
 *                 ret_inner_tb.append(inner_tb)
 *             ret_total_balances.append(ret_inner_tb)
 *         return ret_total_balances             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_total_balances);
  __pyx_r = __pyx_v_ret_total_balances;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":216
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_total_balances(self, vector[vector[double]] total_balances):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (total_balances) to Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.parse_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_total_balances);
  __Pyx_XDECREF(__pyx_v_ret_inner_tb);
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":235
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_merged_total_balances(self, vector[double] merged_total_balances):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (merged_total_balances) to Python list.
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_total_balances(CYTHON_UNUSED struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, std::vector<double>  __pyx_v_merged_total_balances) {
  PyObject *__pyx_v_ret_merged_total_balances = 0;
  double __pyx_v_outer_mtb;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<double> ::iterator __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_merged_total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":241
 *         :return: list, see docstring of FXStrategy class regarding self.merged_total_balances for further details
 *         """
 *         cdef list ret_merged_total_balances = []             # <<<<<<<<<<<<<<
 *         for outer_mtb in merged_total_balances:
 *             ret_merged_total_balances.append(outer_mtb)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_merged_total_balances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":242
 *         """
 *         cdef list ret_merged_total_balances = []
 *         for outer_mtb in merged_total_balances:             # <<<<<<<<<<<<<<
 *             ret_merged_total_balances.append(outer_mtb)
 *         return ret_merged_total_balances
 */
  __pyx_t_2 = __pyx_v_merged_total_balances.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_merged_total_balances.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_outer_mtb = __pyx_t_3;

    /* "trapeza/strategy/fx_strategy.pyx":243
 *         cdef list ret_merged_total_balances = []
 *         for outer_mtb in merged_total_balances:
 *             ret_merged_total_balances.append(outer_mtb)             # <<<<<<<<<<<<<<
 *         return ret_merged_total_balances
 * 
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_outer_mtb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ret_merged_total_balances, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":242
 *         """
 *         cdef list ret_merged_total_balances = []
 *         for outer_mtb in merged_total_balances:             # <<<<<<<<<<<<<<
 *             ret_merged_total_balances.append(outer_mtb)
 *         return ret_merged_total_balances
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":244
 *         for outer_mtb in merged_total_balances:
 *             ret_merged_total_balances.append(outer_mtb)
 *         return ret_merged_total_balances             # <<<<<<<<<<<<<<
 * 
 *     cpdef dict self_parse_positions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_merged_total_balances);
  __pyx_r = __pyx_v_ret_merged_total_balances;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":235
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cdef list parse_merged_total_balances(self, vector[double] merged_total_balances):             # <<<<<<<<<<<<<<
 *         """
 *         Parses input (merged_total_balances) to Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.parse_merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_merged_total_balances);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":246
 *         return ret_merged_total_balances
 * 
 *     cpdef dict self_parse_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_positions and returns a Python dict.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_11self_parse_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_positions", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_11self_parse_positions)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 246, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":251
 *         :return: dict, see docstring of FXStrategy class for further details
 *         """
 *         return self.parse_positions(self.c_positions)             # <<<<<<<<<<<<<<
 * 
 *     cpdef list self_parse_signals(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_positions(__pyx_v_self, __pyx_v_self->c_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":246
 *         return ret_merged_total_balances
 * 
 *     cpdef dict self_parse_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_positions and returns a Python dict.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_11self_parse_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10self_parse_positions[] = "\n        Parses self.c_positions and returns a Python dict.\n        :return: dict, see docstring of FXStrategy class for further details\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_11self_parse_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10self_parse_positions(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10self_parse_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_positions", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_positions(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":253
 *         return self.parse_positions(self.c_positions)
 * 
 *     cpdef list self_parse_signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_signals and returns Python list.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13self_parse_signals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_signals", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_signals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13self_parse_signals)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 253, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":258
 *         :return: list, see docstring of FXStrategy class for further details
 *         """
 *         return self.parse_signals(self.c_signals)             # <<<<<<<<<<<<<<
 * 
 *     cpdef dict self_parse_merged_positions(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_signals(__pyx_v_self, __pyx_v_self->c_signals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":253
 *         return self.parse_positions(self.c_positions)
 * 
 *     cpdef list self_parse_signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_signals and returns Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13self_parse_signals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_12self_parse_signals[] = "\n        Parses self.c_signals and returns Python list.\n        :return: list, see docstring of FXStrategy class for further details\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13self_parse_signals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_signals (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_12self_parse_signals(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_12self_parse_signals(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_signals", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":260
 *         return self.parse_signals(self.c_signals)
 * 
 *     cpdef dict self_parse_merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_merged_positions and returns Python dict.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15self_parse_merged_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_merged_positions", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_merged_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15self_parse_merged_positions)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 260, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":265
 *         :return: dict, see docstring of FXStrategy class for further details
 *         """
 *         return self.parse_merged_positions(self.c_merged_positions)             # <<<<<<<<<<<<<<
 * 
 *     cpdef list self_parse_total_balances(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_merged_positions(__pyx_v_self, __pyx_v_self->c_merged_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":260
 *         return self.parse_signals(self.c_signals)
 * 
 *     cpdef dict self_parse_merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_merged_positions and returns Python dict.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15self_parse_merged_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14self_parse_merged_positions[] = "\n        Parses self.c_merged_positions and returns Python dict.\n        :return: dict, see docstring of FXStrategy class for further details\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15self_parse_merged_positions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_merged_positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14self_parse_merged_positions(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14self_parse_merged_positions(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_merged_positions", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_positions(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":267
 *         return self.parse_merged_positions(self.c_merged_positions)
 * 
 *     cpdef list self_parse_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_total_balances and returns Python list.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17self_parse_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_total_balances", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17self_parse_total_balances)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 267, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":272
 *         :return: list, see docstring of FXStrategy class for further details
 *         """
 *         return self.parse_total_balances(self.c_total_balances)             # <<<<<<<<<<<<<<
 * 
 *     cpdef list self_parse_merged_total_balances(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_total_balances(__pyx_v_self, __pyx_v_self->c_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":267
 *         return self.parse_merged_positions(self.c_merged_positions)
 * 
 *     cpdef list self_parse_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_total_balances and returns Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17self_parse_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_16self_parse_total_balances[] = "\n        Parses self.c_total_balances and returns Python list.\n        :return: list, see docstring of FXStrategy class for further details\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17self_parse_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_16self_parse_total_balances(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_16self_parse_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_total_balances", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_total_balances(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":274
 *         return self.parse_total_balances(self.c_total_balances)
 * 
 *     cpdef list self_parse_merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_merged_total_balances and returns Python list.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19self_parse_merged_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_merged_total_balances", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_merged_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19self_parse_merged_total_balances)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 274, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":279
 *         :return: list, see docstring of FXStrategy class for further details
 *         """
 *         return self.parse_merged_total_balances(self.c_merged_total_balances)             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_merged_total_balances(__pyx_v_self, __pyx_v_self->c_merged_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":274
 *         return self.parse_total_balances(self.c_total_balances)
 * 
 *     cpdef list self_parse_merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self.c_merged_total_balances and returns Python list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19self_parse_merged_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18self_parse_merged_total_balances[] = "\n        Parses self.c_merged_total_balances and returns Python list.\n        :return: list, see docstring of FXStrategy class for further details\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19self_parse_merged_total_balances(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_merged_total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18self_parse_merged_total_balances(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18self_parse_merged_total_balances(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_merged_total_balances", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_total_balances(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":283
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef dict self_parse_signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self._c_signals_at_step_t and returns Python dict.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_21self_parse_signals_at_step_t(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals_at_step_t(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_ret_signals_at_step_t = 0;
  PyObject *__pyx_v_inner_signals_at_step_t = 0;
  std::pair<long,std::vector<std::string> >  __pyx_v_elem;
  PyObject *__pyx_8genexpr5__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::unordered_map<long,std::vector<std::string> > ::iterator __pyx_t_5;
  std::unordered_map<long,std::vector<std::string> >  *__pyx_t_6;
  std::pair<long,std::vector<std::string> >  __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_signals_at_step_t", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_self_parse_signals_at_step_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_21self_parse_signals_at_step_t)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 283, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":292
 *         """
 *         # unordered_map[long,vector[string]] _c_signals_at_step_t
 *         cdef dict ret_signals_at_step_t = {}             # <<<<<<<<<<<<<<
 *         cdef list inner_signals_at_step_t
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_signals_at_step_t = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":295
 *         cdef list inner_signals_at_step_t
 * 
 *         for elem in self._c_signals_at_step_t:             # <<<<<<<<<<<<<<
 *             inner_signals_at_step_t = elem.second
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]
 */
  __pyx_t_6 = &__pyx_v_self->_c_signals_at_step_t;
  __pyx_t_5 = __pyx_t_6->begin();
  for (;;) {
    if (!(__pyx_t_5 != __pyx_t_6->end())) break;
    __pyx_t_7 = *__pyx_t_5;
    ++__pyx_t_5;
    __pyx_v_elem = __pyx_t_7;

    /* "trapeza/strategy/fx_strategy.pyx":296
 * 
 *         for elem in self._c_signals_at_step_t:
 *             inner_signals_at_step_t = elem.second             # <<<<<<<<<<<<<<
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]
 *             ret_signals_at_step_t[elem.first] = inner_signals_at_step_t
 */
    __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_elem.second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyList_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_inner_signals_at_step_t, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":297
 *         for elem in self._c_signals_at_step_t:
 *             inner_signals_at_step_t = elem.second
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]             # <<<<<<<<<<<<<<
 *             ret_signals_at_step_t[elem.first] = inner_signals_at_step_t
 *         return ret_signals_at_step_t
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_v_inner_signals_at_step_t; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 297, __pyx_L7_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_v, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_v, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 297, __pyx_L7_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_v); __pyx_8genexpr5__pyx_v_v = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_v); __pyx_8genexpr5__pyx_v_v = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_inner_signals_at_step_t, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":298
 *             inner_signals_at_step_t = elem.second
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]
 *             ret_signals_at_step_t[elem.first] = inner_signals_at_step_t             # <<<<<<<<<<<<<<
 *         return ret_signals_at_step_t
 * 
 */
    __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_elem.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_ret_signals_at_step_t, __pyx_t_1, __pyx_v_inner_signals_at_step_t) < 0)) __PYX_ERR(0, 298, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":295
 *         cdef list inner_signals_at_step_t
 * 
 *         for elem in self._c_signals_at_step_t:             # <<<<<<<<<<<<<<
 *             inner_signals_at_step_t = elem.second
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":299
 *             inner_signals_at_step_t = [v.decode() for v in inner_signals_at_step_t]
 *             ret_signals_at_step_t[elem.first] = inner_signals_at_step_t
 *         return ret_signals_at_step_t             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret_signals_at_step_t);
  __pyx_r = __pyx_v_ret_signals_at_step_t;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":283
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef dict self_parse_signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Parses self._c_signals_at_step_t and returns Python dict.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_signals_at_step_t);
  __Pyx_XDECREF(__pyx_v_inner_signals_at_step_t);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_21self_parse_signals_at_step_t(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_20self_parse_signals_at_step_t[] = "\n        Parses self._c_signals_at_step_t and returns Python dict.\n        self._c_signals_at_step_t is just an intermediate and auxiliary storage.\n        :return: dict,\n                 key: index position within self.c_accounts\n                 value: list of Python strings representing signals emitted at current time step\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_21self_parse_signals_at_step_t(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self_parse_signals_at_step_t (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_20self_parse_signals_at_step_t(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_20self_parse_signals_at_step_t(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("self_parse_signals_at_step_t", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals_at_step_t(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.self_parse_signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":303
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short positions_from_py(self, dict positions) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of positions and sets self.c_positions.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_positions); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_positions, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_t = 0;
  std::vector<double>  __pyx_v_inner_pos;
  std::vector<std::vector<double> >  __pyx_v_outer_pos;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  std::vector<double>  __pyx_t_11;
  std::string __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("positions_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_positions_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23positions_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_positions) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_positions);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 303, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":310
 *         """
 *         # unordered_map[string, vector[vector[double]]] c_positions
 *         self.c_positions.clear()             # <<<<<<<<<<<<<<
 * 
 *         cdef str k
 */
  __pyx_v_self->c_positions.clear();

  /* "trapeza/strategy/fx_strategy.pyx":316
 *         cdef vector[double] inner_pos
 *         cdef vector[vector[double]] outer_pos
 *         inner_pos.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         outer_pos.reserve(len(positions[list(positions.keys())][0]))
 *         for k, v in positions.items():
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 316, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inner_pos.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":317
 *         cdef vector[vector[double]] outer_pos
 *         inner_pos.reserve(len(self.c_accounts))
 *         outer_pos.reserve(len(positions[list(positions.keys())][0]))             # <<<<<<<<<<<<<<
 *         for k, v in positions.items():
 *             outer_pos.clear()
 */
  if (unlikely(__pyx_v_positions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 317, __pyx_L1_error)
  }
  if (unlikely(__pyx_v_positions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 317, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_positions, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_outer_pos.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":318
 *         inner_pos.reserve(len(self.c_accounts))
 *         outer_pos.reserve(len(positions[list(positions.keys())][0]))
 *         for k, v in positions.items():             # <<<<<<<<<<<<<<
 *             outer_pos.clear()
 *             for t in v:
 */
  __pyx_t_6 = 0;
  if (unlikely(__pyx_v_positions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 318, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_positions, 1, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_1;
  __pyx_t_1 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_7, &__pyx_t_6, &__pyx_t_1, &__pyx_t_3, NULL, __pyx_t_8);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 318, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":319
 *         outer_pos.reserve(len(positions[list(positions.keys())][0]))
 *         for k, v in positions.items():
 *             outer_pos.clear()             # <<<<<<<<<<<<<<
 *             for t in v:
 *                 inner_pos.clear()
 */
    __pyx_v_outer_pos.clear();

    /* "trapeza/strategy/fx_strategy.pyx":320
 *         for k, v in positions.items():
 *             outer_pos.clear()
 *             for t in v:             # <<<<<<<<<<<<<<
 *                 inner_pos.clear()
 *                 inner_pos = t
 */
    if (unlikely(__pyx_v_v == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 320, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_v_v; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0;
    for (;;) {
      if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 320, __pyx_L1_error)
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":321
 *             outer_pos.clear()
 *             for t in v:
 *                 inner_pos.clear()             # <<<<<<<<<<<<<<
 *                 inner_pos = t
 *                 outer_pos.push_back(inner_pos)
 */
      __pyx_v_inner_pos.clear();

      /* "trapeza/strategy/fx_strategy.pyx":322
 *             for t in v:
 *                 inner_pos.clear()
 *                 inner_pos = t             # <<<<<<<<<<<<<<
 *                 outer_pos.push_back(inner_pos)
 *             self.c_positions[k.encode()] = outer_pos
 */
      __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_v_t); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error)
      __pyx_v_inner_pos = __pyx_t_11;

      /* "trapeza/strategy/fx_strategy.pyx":323
 *                 inner_pos.clear()
 *                 inner_pos = t
 *                 outer_pos.push_back(inner_pos)             # <<<<<<<<<<<<<<
 *             self.c_positions[k.encode()] = outer_pos
 *         return 1
 */
      try {
        __pyx_v_outer_pos.push_back(__pyx_v_inner_pos);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 323, __pyx_L1_error)
      }

      /* "trapeza/strategy/fx_strategy.pyx":320
 *         for k, v in positions.items():
 *             outer_pos.clear()
 *             for t in v:             # <<<<<<<<<<<<<<
 *                 inner_pos.clear()
 *                 inner_pos = t
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":324
 *                 inner_pos = t
 *                 outer_pos.push_back(inner_pos)
 *             self.c_positions[k.encode()] = outer_pos             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    if (unlikely(__pyx_v_k == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(0, 324, __pyx_L1_error)
    }
    __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_k, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_self->c_positions[__pyx_t_12]) = __pyx_v_outer_pos;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":325
 *                 outer_pos.push_back(inner_pos)
 *             self.c_positions[k.encode()] = outer_pos
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":303
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short positions_from_py(self, dict positions) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of positions and sets self.c_positions.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.positions_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_positions); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_22positions_from_py[] = "\n        Parses Python dict of positions and sets self.c_positions.\n        :param positions: dict, see docstring of FXStrategy class regarding self.positions for further details\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_positions) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("positions_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positions), (&PyDict_Type), 1, "positions", 1))) __PYX_ERR(0, 303, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_22positions_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_positions));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_22positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_positions) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("positions_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_positions_from_py(__pyx_v_self, __pyx_v_positions, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 303, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.positions_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":329
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short signals_from_py(self, list signals) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python list of signals and sets self.c_signals.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_25signals_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_signals); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_signals_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_signals, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_acc = 0;
  PyObject *__pyx_v_list_sig = 0;
  std::vector<std::string>  __pyx_v_inner_signals;
  std::vector<std::vector<std::string> >  __pyx_v_outer_signals;
  PyObject *__pyx_8genexpr6__pyx_v_sig = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  std::vector<std::string>  __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signals_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_signals_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_25signals_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_signals) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_signals);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":336
 *         """
 *         # vector[vector[vector[string]]] c_signals
 *         self.c_signals.clear()             # <<<<<<<<<<<<<<
 * 
 *         cdef list t, acc, list_sig
 */
  __pyx_v_self->c_signals.clear();

  /* "trapeza/strategy/fx_strategy.pyx":342
 *         cdef vector[string] inner_signals
 *         cdef vector[vector[string]] outer_signals
 *         outer_signals.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         for t in signals:
 *             outer_signals.clear()
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 342, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_outer_signals.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":343
 *         cdef vector[vector[string]] outer_signals
 *         outer_signals.reserve(len(self.c_accounts))
 *         for t in signals:             # <<<<<<<<<<<<<<
 *             outer_signals.clear()
 *             for acc in t:
 */
  if (unlikely(__pyx_v_signals == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 343, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_signals; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":344
 *         outer_signals.reserve(len(self.c_accounts))
 *         for t in signals:
 *             outer_signals.clear()             # <<<<<<<<<<<<<<
 *             for acc in t:
 *                 inner_signals.clear()
 */
    __pyx_v_outer_signals.clear();

    /* "trapeza/strategy/fx_strategy.pyx":345
 *         for t in signals:
 *             outer_signals.clear()
 *             for acc in t:             # <<<<<<<<<<<<<<
 *                 inner_signals.clear()
 *                 list_sig = [sig.encode() for sig in acc]
 */
    if (unlikely(__pyx_v_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 345, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_v_t; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
    for (;;) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 345, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_acc, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":346
 *             outer_signals.clear()
 *             for acc in t:
 *                 inner_signals.clear()             # <<<<<<<<<<<<<<
 *                 list_sig = [sig.encode() for sig in acc]
 *                 inner_signals = list_sig
 */
      __pyx_v_inner_signals.clear();

      /* "trapeza/strategy/fx_strategy.pyx":347
 *             for acc in t:
 *                 inner_signals.clear()
 *                 list_sig = [sig.encode() for sig in acc]             # <<<<<<<<<<<<<<
 *                 inner_signals = list_sig
 *                 outer_signals.push_back(inner_signals)
 */
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__pyx_v_acc == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 347, __pyx_L9_error)
        }
        __pyx_t_4 = __pyx_v_acc; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
        for (;;) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 347, __pyx_L9_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
          if (!(likely(PyUnicode_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 347, __pyx_L9_error)
          __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_sig, ((PyObject*)__pyx_t_9));
          __pyx_t_9 = 0;
          if (unlikely(__pyx_8genexpr6__pyx_v_sig == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
            __PYX_ERR(0, 347, __pyx_L9_error)
          }
          __pyx_t_9 = PyUnicode_AsEncodedString(__pyx_8genexpr6__pyx_v_sig, NULL, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 347, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_sig); __pyx_8genexpr6__pyx_v_sig = 0;
        goto __pyx_L12_exit_scope;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_sig); __pyx_8genexpr6__pyx_v_sig = 0;
        goto __pyx_L1_error;
        __pyx_L12_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_list_sig, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":348
 *                 inner_signals.clear()
 *                 list_sig = [sig.encode() for sig in acc]
 *                 inner_signals = list_sig             # <<<<<<<<<<<<<<
 *                 outer_signals.push_back(inner_signals)
 *             self.c_signals.push_back(outer_signals)
 */
      __pyx_t_10 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_list_sig); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error)
      __pyx_v_inner_signals = __pyx_t_10;

      /* "trapeza/strategy/fx_strategy.pyx":349
 *                 list_sig = [sig.encode() for sig in acc]
 *                 inner_signals = list_sig
 *                 outer_signals.push_back(inner_signals)             # <<<<<<<<<<<<<<
 *             self.c_signals.push_back(outer_signals)
 *         return 1
 */
      try {
        __pyx_v_outer_signals.push_back(__pyx_v_inner_signals);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 349, __pyx_L1_error)
      }

      /* "trapeza/strategy/fx_strategy.pyx":345
 *         for t in signals:
 *             outer_signals.clear()
 *             for acc in t:             # <<<<<<<<<<<<<<
 *                 inner_signals.clear()
 *                 list_sig = [sig.encode() for sig in acc]
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":350
 *                 inner_signals = list_sig
 *                 outer_signals.push_back(inner_signals)
 *             self.c_signals.push_back(outer_signals)             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    try {
      __pyx_v_self->c_signals.push_back(__pyx_v_outer_signals);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 350, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":343
 *         cdef vector[vector[string]] outer_signals
 *         outer_signals.reserve(len(self.c_accounts))
 *         for t in signals:             # <<<<<<<<<<<<<<
 *             outer_signals.clear()
 *             for acc in t:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":351
 *                 outer_signals.push_back(inner_signals)
 *             self.c_signals.push_back(outer_signals)
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":329
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short signals_from_py(self, list signals) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python list of signals and sets self.c_signals.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.signals_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_acc);
  __Pyx_XDECREF(__pyx_v_list_sig);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_sig);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_25signals_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_signals); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_24signals_from_py[] = "\n        Parses Python list of signals and sets self.c_signals.\n        :param signals: list, see docstring of FXStrategy class regarding self.signals for further details\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_25signals_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_signals) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("signals_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signals), (&PyList_Type), 1, "signals", 1))) __PYX_ERR(0, 329, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_24signals_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_signals));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_24signals_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_signals) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signals_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_signals_from_py(__pyx_v_self, __pyx_v_signals, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 329, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.signals_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":355
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short merged_positions_from_py(self, dict merged_positions) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of merged_positions and sets self.c_merged_positions.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_27merged_positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_positions); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_positions, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_k = 0;
  std::vector<double>  __pyx_v_inner_mp;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  std::vector<double> ::size_type __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  std::vector<double>  __pyx_t_11;
  std::string __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_positions_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_merged_positions_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_27merged_positions_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_merged_positions) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_merged_positions);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":363
 *         """
 *         # unordered_map[string, vector[double]] c_merged_positions
 *         self.c_merged_positions.clear()             # <<<<<<<<<<<<<<
 * 
 *         cdef list v
 */
  __pyx_v_self->c_merged_positions.clear();

  /* "trapeza/strategy/fx_strategy.pyx":368
 *         cdef str k
 *         cdef vector[double] inner_mp
 *         inner_mp.reserve(merged_positions[list(merged_positions.keys())][0])             # <<<<<<<<<<<<<<
 *         for k, v in merged_positions.items():
 *             inner_mp.clear()
 */
  if (unlikely(__pyx_v_merged_positions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 368, __pyx_L1_error)
  }
  if (unlikely(__pyx_v_merged_positions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 368, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_merged_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_merged_positions, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_inner_mp.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":369
 *         cdef vector[double] inner_mp
 *         inner_mp.reserve(merged_positions[list(merged_positions.keys())][0])
 *         for k, v in merged_positions.items():             # <<<<<<<<<<<<<<
 *             inner_mp.clear()
 *             inner_mp = v
 */
  __pyx_t_7 = 0;
  if (unlikely(__pyx_v_merged_positions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 369, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_merged_positions, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_1;
  __pyx_t_1 = 0;
  while (1) {
    __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_8, &__pyx_t_7, &__pyx_t_1, &__pyx_t_3, NULL, __pyx_t_9);
    if (unlikely(__pyx_t_10 == 0)) break;
    if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 369, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":370
 *         inner_mp.reserve(merged_positions[list(merged_positions.keys())][0])
 *         for k, v in merged_positions.items():
 *             inner_mp.clear()             # <<<<<<<<<<<<<<
 *             inner_mp = v
 *             self.c_merged_positions[k.encode()] = inner_mp
 */
    __pyx_v_inner_mp.clear();

    /* "trapeza/strategy/fx_strategy.pyx":371
 *         for k, v in merged_positions.items():
 *             inner_mp.clear()
 *             inner_mp = v             # <<<<<<<<<<<<<<
 *             self.c_merged_positions[k.encode()] = inner_mp
 *         return 1
 */
    __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error)
    __pyx_v_inner_mp = __pyx_t_11;

    /* "trapeza/strategy/fx_strategy.pyx":372
 *             inner_mp.clear()
 *             inner_mp = v
 *             self.c_merged_positions[k.encode()] = inner_mp             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    if (unlikely(__pyx_v_k == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
      __PYX_ERR(0, 372, __pyx_L1_error)
    }
    __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_k, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_self->c_merged_positions[__pyx_t_12]) = __pyx_v_inner_mp;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":373
 *             inner_mp = v
 *             self.c_merged_positions[k.encode()] = inner_mp
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":355
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short merged_positions_from_py(self, dict merged_positions) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of merged_positions and sets self.c_merged_positions.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.merged_positions_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_27merged_positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_positions); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_26merged_positions_from_py[] = "\n        Parses Python dict of merged_positions and sets self.c_merged_positions.\n        :param merged_positions: dict, see docstring of FXStrategy class regarding self.merged_positions for \n                                 further details\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_27merged_positions_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_positions) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_positions_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_merged_positions), (&PyDict_Type), 1, "merged_positions", 1))) __PYX_ERR(0, 355, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_26merged_positions_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_merged_positions));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_26merged_positions_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_positions) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_positions_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_positions_from_py(__pyx_v_self, __pyx_v_merged_positions, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 355, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.merged_positions_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":377
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short total_balances_from_py(self, list total_balances) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses list of total_balances and sets self.c_total_balances.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_29total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_total_balances); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_total_balances, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_l = 0;
  std::vector<double>  __pyx_v_inner_total_balances;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  std::vector<double>  __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("total_balances_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_total_balances_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_29total_balances_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_total_balances) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_total_balances);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":384
 *         """
 *         # vector[vector[double]] c_total_balances
 *         self.c_total_balances.clear()             # <<<<<<<<<<<<<<
 * 
 *         cdef list l
 */
  __pyx_v_self->c_total_balances.clear();

  /* "trapeza/strategy/fx_strategy.pyx":388
 *         cdef list l
 *         cdef vector[double] inner_total_balances
 *         inner_total_balances.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         for l in total_balances:
 *             inner_total_balances.clear()
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 388, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inner_total_balances.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":389
 *         cdef vector[double] inner_total_balances
 *         inner_total_balances.reserve(len(self.c_accounts))
 *         for l in total_balances:             # <<<<<<<<<<<<<<
 *             inner_total_balances.clear()
 *             inner_total_balances = l
 */
  if (unlikely(__pyx_v_total_balances == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 389, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_total_balances; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 389, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_l, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":390
 *         inner_total_balances.reserve(len(self.c_accounts))
 *         for l in total_balances:
 *             inner_total_balances.clear()             # <<<<<<<<<<<<<<
 *             inner_total_balances = l
 *             self.c_total_balances.push_back(inner_total_balances)
 */
    __pyx_v_inner_total_balances.clear();

    /* "trapeza/strategy/fx_strategy.pyx":391
 *         for l in total_balances:
 *             inner_total_balances.clear()
 *             inner_total_balances = l             # <<<<<<<<<<<<<<
 *             self.c_total_balances.push_back(inner_total_balances)
 * 
 */
    __pyx_t_7 = __pyx_convert_vector_from_py_double(__pyx_v_l); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error)
    __pyx_v_inner_total_balances = __pyx_t_7;

    /* "trapeza/strategy/fx_strategy.pyx":392
 *             inner_total_balances.clear()
 *             inner_total_balances = l
 *             self.c_total_balances.push_back(inner_total_balances)             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
    try {
      __pyx_v_self->c_total_balances.push_back(__pyx_v_inner_total_balances);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 392, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":389
 *         cdef vector[double] inner_total_balances
 *         inner_total_balances.reserve(len(self.c_accounts))
 *         for l in total_balances:             # <<<<<<<<<<<<<<
 *             inner_total_balances.clear()
 *             inner_total_balances = l
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":377
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short total_balances_from_py(self, list total_balances) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses list of total_balances and sets self.c_total_balances.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.total_balances_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_29total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_total_balances); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_28total_balances_from_py[] = "\n        Parses list of total_balances and sets self.c_total_balances.\n        :param total_balances: list, see docstring of FXStrategy class regarding self.total_balances for further details\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_29total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_total_balances) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("total_balances_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_total_balances), (&PyList_Type), 1, "total_balances", 1))) __PYX_ERR(0, 377, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_28total_balances_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_total_balances));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_28total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_total_balances) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("total_balances_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_total_balances_from_py(__pyx_v_self, __pyx_v_total_balances, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 377, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.total_balances_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":396
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short merged_total_balances_from_py(self, list merged_total_balances) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses list of merged_total_balances and sets self.c_merged_total_balances
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_31merged_total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_total_balances); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_total_balances, int __pyx_skip_dispatch) {
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  std::vector<double>  __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_total_balances_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_merged_total_balances_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_31merged_total_balances_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_merged_total_balances) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_merged_total_balances);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":404
 *         """
 *         # vector[double] c_merged_total_balances
 *         self.c_merged_total_balances.clear()             # <<<<<<<<<<<<<<
 *         self.c_merged_total_balances = merged_total_balances
 *         return 1
 */
  __pyx_v_self->c_merged_total_balances.clear();

  /* "trapeza/strategy/fx_strategy.pyx":405
 *         # vector[double] c_merged_total_balances
 *         self.c_merged_total_balances.clear()
 *         self.c_merged_total_balances = merged_total_balances             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  __pyx_t_6 = __pyx_convert_vector_from_py_double(__pyx_v_merged_total_balances); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error)
  __pyx_v_self->c_merged_total_balances = __pyx_t_6;

  /* "trapeza/strategy/fx_strategy.pyx":406
 *         self.c_merged_total_balances.clear()
 *         self.c_merged_total_balances = merged_total_balances
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":396
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short merged_total_balances_from_py(self, list merged_total_balances) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses list of merged_total_balances and sets self.c_merged_total_balances
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.merged_total_balances_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_31merged_total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_total_balances); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_30merged_total_balances_from_py[] = "\n        Parses list of merged_total_balances and sets self.c_merged_total_balances\n        :param merged_total_balances: list, see docstring of FXStrategy class regarding self.merged_total_balances \n                                      for further details\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_31merged_total_balances_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v_merged_total_balances) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_total_balances_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_merged_total_balances), (&PyList_Type), 1, "merged_total_balances", 1))) __PYX_ERR(0, 396, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_30merged_total_balances_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v_merged_total_balances));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_30merged_total_balances_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_merged_total_balances) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_total_balances_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_total_balances_from_py(__pyx_v_self, __pyx_v_merged_total_balances, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 396, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.merged_total_balances_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":410
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short _signals_at_step_t_from_py(self, dict _signals_at_step_t) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of _signals_at_step_t and sets self._c_signals_at_step_t.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_33_signals_at_step_t_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__signals_at_step_t_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t, int __pyx_skip_dispatch) {
  long __pyx_v_k;
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_v_parsed_list = 0;
  std::vector<std::string>  __pyx_v_inner;
  PyObject *__pyx_8genexpr7__pyx_v_s = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  std::vector<std::string>  __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signals_at_step_t_from_py", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_signals_at_step_t_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_33_signals_at_step_t_from_py)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v__signals_at_step_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v__signals_at_step_t);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 410, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":424
 *         cdef vector[string] inner
 *         # we cannot reserve vector as lists in _signals_at_step_t might have varying lengths
 *         for k, l in _signals_at_step_t.items():             # <<<<<<<<<<<<<<
 *             inner.clear()
 *             if len(l) > 0:
 */
  __pyx_t_6 = 0;
  if (unlikely(__pyx_v__signals_at_step_t == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 424, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_dict_iterator(__pyx_v__signals_at_step_t, 1, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_6, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_8);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 424, __pyx_L1_error)
    __pyx_v_k = __pyx_t_10;
    __Pyx_XDECREF_SET(__pyx_v_l, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":425
 *         # we cannot reserve vector as lists in _signals_at_step_t might have varying lengths
 *         for k, l in _signals_at_step_t.items():
 *             inner.clear()             # <<<<<<<<<<<<<<
 *             if len(l) > 0:
 *                 parsed_list = [s.encode() for s in l]
 */
    __pyx_v_inner.clear();

    /* "trapeza/strategy/fx_strategy.pyx":426
 *         for k, l in _signals_at_step_t.items():
 *             inner.clear()
 *             if len(l) > 0:             # <<<<<<<<<<<<<<
 *                 parsed_list = [s.encode() for s in l]
 *                 inner = parsed_list
 */
    if (unlikely(__pyx_v_l == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 426, __pyx_L1_error)
    }
    __pyx_t_11 = PyList_GET_SIZE(__pyx_v_l); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 426, __pyx_L1_error)
    __pyx_t_12 = ((__pyx_t_11 > 0) != 0);
    if (__pyx_t_12) {

      /* "trapeza/strategy/fx_strategy.pyx":427
 *             inner.clear()
 *             if len(l) > 0:
 *                 parsed_list = [s.encode() for s in l]             # <<<<<<<<<<<<<<
 *                 inner = parsed_list
 *             self._c_signals_at_step_t[k] = inner
 */
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__pyx_v_l == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 427, __pyx_L8_error)
        }
        __pyx_t_2 = __pyx_v_l; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
        for (;;) {
          if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 427, __pyx_L8_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
          if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 427, __pyx_L8_error)
          __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_s, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;
          if (unlikely(__pyx_8genexpr7__pyx_v_s == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
            __PYX_ERR(0, 427, __pyx_L8_error)
          }
          __pyx_t_4 = PyUnicode_AsEncodedString(__pyx_8genexpr7__pyx_v_s, NULL, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 427, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_s); __pyx_8genexpr7__pyx_v_s = 0;
        goto __pyx_L11_exit_scope;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_s); __pyx_8genexpr7__pyx_v_s = 0;
        goto __pyx_L1_error;
        __pyx_L11_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_parsed_list, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":428
 *             if len(l) > 0:
 *                 parsed_list = [s.encode() for s in l]
 *                 inner = parsed_list             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t[k] = inner
 *         return 1
 */
      __pyx_t_13 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_parsed_list); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error)
      __pyx_v_inner = __pyx_t_13;

      /* "trapeza/strategy/fx_strategy.pyx":426
 *         for k, l in _signals_at_step_t.items():
 *             inner.clear()
 *             if len(l) > 0:             # <<<<<<<<<<<<<<
 *                 parsed_list = [s.encode() for s in l]
 *                 inner = parsed_list
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":429
 *                 parsed_list = [s.encode() for s in l]
 *                 inner = parsed_list
 *             self._c_signals_at_step_t[k] = inner             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
    (__pyx_v_self->_c_signals_at_step_t[__pyx_v_k]) = __pyx_v_inner;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":430
 *                 inner = parsed_list
 *             self._c_signals_at_step_t[k] = inner
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     cdef short c_evaluate(self, dict data_frame, string reference_currency, bool_t append_to_results,
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":410
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef short _signals_at_step_t_from_py(self, dict _signals_at_step_t) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Parses Python dict of _signals_at_step_t and sets self._c_signals_at_step_t.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._signals_at_step_t_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_parsed_list);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_s);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_33_signals_at_step_t_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_32_signals_at_step_t_from_py[] = "\n        Parses Python dict of _signals_at_step_t and sets self._c_signals_at_step_t.\n        :param _signals_at_step_t: dict, see self.self_parse_signals_at_step_t or FXStrategy for further details\n                                   key: index positions of respective account in self.c_accounts\n                                   value: list of Python strings representing signals emitted at current time step\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_33_signals_at_step_t_from_py(PyObject *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_signals_at_step_t_from_py (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__signals_at_step_t), (&PyDict_Type), 1, "_signals_at_step_t", 1))) __PYX_ERR(0, 410, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_32_signals_at_step_t_from_py(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject*)__pyx_v__signals_at_step_t));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_32_signals_at_step_t_from_py(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v__signals_at_step_t) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signals_at_step_t_from_py", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__signals_at_step_t_from_py(__pyx_v_self, __pyx_v__signals_at_step_t, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 410, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._signals_at_step_t_from_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":432
 *         return 1
 * 
 *     cdef short c_evaluate(self, dict data_frame, string reference_currency, bool_t append_to_results,             # <<<<<<<<<<<<<<
 *                           vector[vector[string]] *ret_signals, vector[unordered_map[string, double]] *ret_positions,
 *                           vector[double] *ret_total_balances) except -1:
 */

static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, bool __pyx_v_append_to_results, std::vector<std::vector<std::string> >  *__pyx_v_ret_signals, std::vector<std::unordered_map<std::string,double> >  *__pyx_v_ret_positions, std::vector<double>  *__pyx_v_ret_total_balances) {
  std::vector<std::vector<std::string> >  __pyx_v_signals;
  std::vector<std::string>  __pyx_v_inner_signals;
  std::vector<long>  __pyx_v_signals_at_step_t_keys;
  long __pyx_v_acc_index;
  long __pyx_v_comp_val;
  std::pair<long,std::vector<std::string> >  __pyx_v_n;
  std::vector<std::unordered_map<std::string,double> >  __pyx_v_positions;
  std::vector<std::string>  __pyx_v_all_currencies;
  long __pyx_v_i;
  std::unordered_map<std::string,double>  __pyx_v_dict_positions;
  std::string __pyx_v_currency;
  std::vector<double>  __pyx_v_total_balances;
  PyObject *__pyx_v_data_current_step = 0;
  PyObject *__pyx_v_parsed_data_current_step = 0;
  double __pyx_v_sum_total_balances;
  double __pyx_v_sum_positions;
  std::vector<double>  __pyx_v_vec_sum_positions;
  std::vector<double>  __pyx_v_pos;
  std::vector<std::vector<double> >  __pyx_v_vec_pos;
  std::unordered_map<std::string,double>  __pyx_v_dict_acc;
  PyObject *__pyx_8genexpr8__pyx_v_u = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr10__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_k = NULL;
  double __pyx_9genexpr11__pyx_v_v;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  std::unordered_map<long,std::vector<std::string> > ::iterator __pyx_t_3;
  std::unordered_map<long,std::vector<std::string> >  *__pyx_t_4;
  std::pair<long,std::vector<std::string> >  __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  long __pyx_t_7;
  std::vector<long> ::iterator __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  std::vector<std::string>  __pyx_t_17;
  std::vector<std::string> ::iterator __pyx_t_18;
  std::string __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  double __pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  std::vector<double> ::size_type __pyx_t_28;
  std::vector<double> ::size_type __pyx_t_29;
  std::vector<std::unordered_map<std::string,double> > ::iterator __pyx_t_30;
  std::unordered_map<std::string,double>  __pyx_t_31;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_evaluate", 0);

  /* "trapeza/strategy/fx_strategy.pyx":449
 *         cdef vector[string] inner_signals
 *         cdef vector[long] signals_at_step_t_keys
 *         cdef long acc_index = 0             # <<<<<<<<<<<<<<
 *         cdef long comp_val
 *         signals.reserve(len(self.c_accounts))
 */
  __pyx_v_acc_index = 0;

  /* "trapeza/strategy/fx_strategy.pyx":451
 *         cdef long acc_index = 0
 *         cdef long comp_val
 *         signals.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         signals_at_step_t_keys.reserve(len(self.c_accounts))
 *         for n in self._c_signals_at_step_t:
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 451, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_signals.reserve(__pyx_t_2);

  /* "trapeza/strategy/fx_strategy.pyx":452
 *         cdef long comp_val
 *         signals.reserve(len(self.c_accounts))
 *         signals_at_step_t_keys.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         for n in self._c_signals_at_step_t:
 *             signals_at_step_t_keys.push_back(n.first)
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 452, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_signals_at_step_t_keys.reserve(__pyx_t_2);

  /* "trapeza/strategy/fx_strategy.pyx":453
 *         signals.reserve(len(self.c_accounts))
 *         signals_at_step_t_keys.reserve(len(self.c_accounts))
 *         for n in self._c_signals_at_step_t:             # <<<<<<<<<<<<<<
 *             signals_at_step_t_keys.push_back(n.first)
 *         # signals_at_step_t_keys = list(self._c_signals_at_step_t)
 */
  __pyx_t_4 = &__pyx_v_self->_c_signals_at_step_t;
  __pyx_t_3 = __pyx_t_4->begin();
  for (;;) {
    if (!(__pyx_t_3 != __pyx_t_4->end())) break;
    __pyx_t_5 = *__pyx_t_3;
    ++__pyx_t_3;
    __pyx_v_n = __pyx_t_5;

    /* "trapeza/strategy/fx_strategy.pyx":454
 *         signals_at_step_t_keys.reserve(len(self.c_accounts))
 *         for n in self._c_signals_at_step_t:
 *             signals_at_step_t_keys.push_back(n.first)             # <<<<<<<<<<<<<<
 *         # signals_at_step_t_keys = list(self._c_signals_at_step_t)
 *         for acc_index in range(len(self.c_accounts)):
 */
    try {
      __pyx_v_signals_at_step_t_keys.push_back(__pyx_v_n.first);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 454, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":453
 *         signals.reserve(len(self.c_accounts))
 *         signals_at_step_t_keys.reserve(len(self.c_accounts))
 *         for n in self._c_signals_at_step_t:             # <<<<<<<<<<<<<<
 *             signals_at_step_t_keys.push_back(n.first)
 *         # signals_at_step_t_keys = list(self._c_signals_at_step_t)
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":456
 *             signals_at_step_t_keys.push_back(n.first)
 *         # signals_at_step_t_keys = list(self._c_signals_at_step_t)
 *         for acc_index in range(len(self.c_accounts)):             # <<<<<<<<<<<<<<
 *             inner_signals.clear()
 *             # if acc_index in signals_at_step_t_keys:
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 456, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __pyx_t_2;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_acc_index = __pyx_t_7;

    /* "trapeza/strategy/fx_strategy.pyx":457
 *         # signals_at_step_t_keys = list(self._c_signals_at_step_t)
 *         for acc_index in range(len(self.c_accounts)):
 *             inner_signals.clear()             # <<<<<<<<<<<<<<
 *             # if acc_index in signals_at_step_t_keys:
 *             for comp_val in signals_at_step_t_keys:
 */
    __pyx_v_inner_signals.clear();

    /* "trapeza/strategy/fx_strategy.pyx":459
 *             inner_signals.clear()
 *             # if acc_index in signals_at_step_t_keys:
 *             for comp_val in signals_at_step_t_keys:             # <<<<<<<<<<<<<<
 *                 if comp_val == acc_index:
 *                     inner_signals = self._c_signals_at_step_t[acc_index]
 */
    __pyx_t_8 = __pyx_v_signals_at_step_t_keys.begin();
    for (;;) {
      if (!(__pyx_t_8 != __pyx_v_signals_at_step_t_keys.end())) break;
      __pyx_t_9 = *__pyx_t_8;
      ++__pyx_t_8;
      __pyx_v_comp_val = __pyx_t_9;

      /* "trapeza/strategy/fx_strategy.pyx":460
 *             # if acc_index in signals_at_step_t_keys:
 *             for comp_val in signals_at_step_t_keys:
 *                 if comp_val == acc_index:             # <<<<<<<<<<<<<<
 *                     inner_signals = self._c_signals_at_step_t[acc_index]
 *             signals.push_back(inner_signals)
 */
      __pyx_t_10 = ((__pyx_v_comp_val == __pyx_v_acc_index) != 0);
      if (__pyx_t_10) {

        /* "trapeza/strategy/fx_strategy.pyx":461
 *             for comp_val in signals_at_step_t_keys:
 *                 if comp_val == acc_index:
 *                     inner_signals = self._c_signals_at_step_t[acc_index]             # <<<<<<<<<<<<<<
 *             signals.push_back(inner_signals)
 * 
 */
        __pyx_v_inner_signals = (__pyx_v_self->_c_signals_at_step_t[__pyx_v_acc_index]);

        /* "trapeza/strategy/fx_strategy.pyx":460
 *             # if acc_index in signals_at_step_t_keys:
 *             for comp_val in signals_at_step_t_keys:
 *                 if comp_val == acc_index:             # <<<<<<<<<<<<<<
 *                     inner_signals = self._c_signals_at_step_t[acc_index]
 *             signals.push_back(inner_signals)
 */
      }

      /* "trapeza/strategy/fx_strategy.pyx":459
 *             inner_signals.clear()
 *             # if acc_index in signals_at_step_t_keys:
 *             for comp_val in signals_at_step_t_keys:             # <<<<<<<<<<<<<<
 *                 if comp_val == acc_index:
 *                     inner_signals = self._c_signals_at_step_t[acc_index]
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":462
 *                 if comp_val == acc_index:
 *                     inner_signals = self._c_signals_at_step_t[acc_index]
 *             signals.push_back(inner_signals)             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[unordered_map[string, double]] positions
 */
    try {
      __pyx_v_signals.push_back(__pyx_v_inner_signals);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 462, __pyx_L1_error)
    }
  }

  /* "trapeza/strategy/fx_strategy.pyx":465
 * 
 *         cdef vector[unordered_map[string, double]] positions
 *         positions.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         cdef str u
 *         cdef vector[string] all_currencies = [u.encode() for u in set(itertools.chain(*data_frame.keys()))]
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 465, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_positions.reserve(__pyx_t_2);

  /* "trapeza/strategy/fx_strategy.pyx":467
 *         positions.reserve(len(self.c_accounts))
 *         cdef str u
 *         cdef vector[string] all_currencies = [u.encode() for u in set(itertools.chain(*data_frame.keys()))]             # <<<<<<<<<<<<<<
 *         cdef long i = 0
 *         cdef unordered_map[string, double] dict_positions
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_itertools); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_chain); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(__pyx_v_data_frame == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
      __PYX_ERR(0, 467, __pyx_L12_error)
    }
    __pyx_t_13 = __Pyx_PyDict_Keys(__pyx_v_data_frame); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = __Pyx_PySequence_Tuple(__pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PySet_New(__pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_set_iterator(__pyx_t_15, 1, (&__pyx_t_6), (&__pyx_t_12)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 467, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_11);
    __pyx_t_11 = __pyx_t_13;
    __pyx_t_13 = 0;
    while (1) {
      __pyx_t_16 = __Pyx_set_iter_next(__pyx_t_11, __pyx_t_6, &__pyx_t_2, &__pyx_t_13, __pyx_t_12);
      if (unlikely(__pyx_t_16 == 0)) break;
      if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 467, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_13)->tp_name), 0))) __PYX_ERR(0, 467, __pyx_L12_error)
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_u, ((PyObject*)__pyx_t_13));
      __pyx_t_13 = 0;
      if (unlikely(__pyx_8genexpr8__pyx_v_u == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
        __PYX_ERR(0, 467, __pyx_L12_error)
      }
      __pyx_t_13 = PyUnicode_AsEncodedString(__pyx_8genexpr8__pyx_v_u, NULL, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 467, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 467, __pyx_L12_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_u); __pyx_8genexpr8__pyx_v_u = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_u); __pyx_8genexpr8__pyx_v_u = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_t_17 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_all_currencies = __pyx_t_17;

  /* "trapeza/strategy/fx_strategy.pyx":468
 *         cdef str u
 *         cdef vector[string] all_currencies = [u.encode() for u in set(itertools.chain(*data_frame.keys()))]
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef unordered_map[string, double] dict_positions
 *         cdef string currency
 */
  __pyx_v_i = 0;

  /* "trapeza/strategy/fx_strategy.pyx":471
 *         cdef unordered_map[string, double] dict_positions
 *         cdef string currency
 *         for i in range(len(self.c_accounts)):             # <<<<<<<<<<<<<<
 *             dict_positions.clear()
 *             for currency in all_currencies:
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 471, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_6;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_2; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "trapeza/strategy/fx_strategy.pyx":472
 *         cdef string currency
 *         for i in range(len(self.c_accounts)):
 *             dict_positions.clear()             # <<<<<<<<<<<<<<
 *             for currency in all_currencies:
 *                 try:
 */
    __pyx_v_dict_positions.clear();

    /* "trapeza/strategy/fx_strategy.pyx":473
 *         for i in range(len(self.c_accounts)):
 *             dict_positions.clear()
 *             for currency in all_currencies:             # <<<<<<<<<<<<<<
 *                 try:
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 */
    __pyx_t_18 = __pyx_v_all_currencies.begin();
    for (;;) {
      if (!(__pyx_t_18 != __pyx_v_all_currencies.end())) break;
      __pyx_t_19 = *__pyx_t_18;
      ++__pyx_t_18;
      __pyx_v_currency = __pyx_t_19;

      /* "trapeza/strategy/fx_strategy.pyx":474
 *             dict_positions.clear()
 *             for currency in all_currencies:
 *                 try:             # <<<<<<<<<<<<<<
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 *                 except AttributeError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_22);
        /*try:*/ {

          /* "trapeza/strategy/fx_strategy.pyx":475
 *             for currency in all_currencies:
 *                 try:
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)             # <<<<<<<<<<<<<<
 *                 except AttributeError:
 *                     dict_positions[currency] = self.c_accounts[i].position(currency.decode())
 */
          if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 475, __pyx_L20_error)
          }
          __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_self->c_accounts, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_c_position); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 475, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_currency); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_15 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
            }
          }
          __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_15, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_11);
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L20_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          (__pyx_v_dict_positions[__pyx_v_currency]) = __pyx_t_23;

          /* "trapeza/strategy/fx_strategy.pyx":474
 *             dict_positions.clear()
 *             for currency in all_currencies:
 *                 try:             # <<<<<<<<<<<<<<
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 *                 except AttributeError:
 */
        }
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L27_try_end;
        __pyx_L20_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":476
 *                 try:
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 *                 except AttributeError:             # <<<<<<<<<<<<<<
 *                     dict_positions[currency] = self.c_accounts[i].position(currency.decode())
 *             positions.push_back(dict_positions)
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_13, &__pyx_t_11) < 0) __PYX_ERR(0, 476, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_t_11);

          /* "trapeza/strategy/fx_strategy.pyx":477
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 *                 except AttributeError:
 *                     dict_positions[currency] = self.c_accounts[i].position(currency.decode())             # <<<<<<<<<<<<<<
 *             positions.push_back(dict_positions)
 * 
 */
          if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 477, __pyx_L22_except_error)
          }
          __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_self->c_accounts, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 477, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_position); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 477, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_24);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_decode_cpp_string(__pyx_v_currency, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 477, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_25 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_24))) {
            __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24);
            if (likely(__pyx_t_25)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
              __Pyx_INCREF(__pyx_t_25);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_24, function);
            }
          }
          __pyx_t_15 = (__pyx_t_25) ? __Pyx_PyObject_Call2Args(__pyx_t_24, __pyx_t_25, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_t_14);
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 477, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
          __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L22_except_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          (__pyx_v_dict_positions[__pyx_v_currency]) = __pyx_t_23;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L21_exception_handled;
        }
        goto __pyx_L22_except_error;
        __pyx_L22_except_error:;

        /* "trapeza/strategy/fx_strategy.pyx":474
 *             dict_positions.clear()
 *             for currency in all_currencies:
 *                 try:             # <<<<<<<<<<<<<<
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 *                 except AttributeError:
 */
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        goto __pyx_L1_error;
        __pyx_L21_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        __pyx_L27_try_end:;
      }

      /* "trapeza/strategy/fx_strategy.pyx":473
 *         for i in range(len(self.c_accounts)):
 *             dict_positions.clear()
 *             for currency in all_currencies:             # <<<<<<<<<<<<<<
 *                 try:
 *                     dict_positions[currency] = self.c_accounts[i].c_position(currency)
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":478
 *                 except AttributeError:
 *                     dict_positions[currency] = self.c_accounts[i].position(currency.decode())
 *             positions.push_back(dict_positions)             # <<<<<<<<<<<<<<
 * 
 *         cdef vector[double] total_balances
 */
    try {
      __pyx_v_positions.push_back(__pyx_v_dict_positions);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 478, __pyx_L1_error)
    }
  }

  /* "trapeza/strategy/fx_strategy.pyx":481
 * 
 *         cdef vector[double] total_balances
 *         total_balances.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         cdef dict data_current_step
 *         cdef double v
 */
  __pyx_t_11 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_11);
  if (unlikely(__pyx_t_11 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 481, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_11); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_total_balances.reserve(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":486
 *         cdef tuple k
 *         cdef dict parsed_data_current_step
 *         try:             # <<<<<<<<<<<<<<
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}
 *         except (TypeError, IndexError):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
    __Pyx_XGOTREF(__pyx_t_22);
    __Pyx_XGOTREF(__pyx_t_21);
    __Pyx_XGOTREF(__pyx_t_20);
    /*try:*/ {

      /* "trapeza/strategy/fx_strategy.pyx":487
 *         cdef dict parsed_data_current_step
 *         try:
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}             # <<<<<<<<<<<<<<
 *         except (TypeError, IndexError):
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 */
      { /* enter inner scope */
        __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 487, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_6 = 0;
        if (unlikely(__pyx_v_data_frame == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
          __PYX_ERR(0, 487, __pyx_L38_error)
        }
        __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_data_frame, 1, __pyx_n_s_keys, (&__pyx_t_2), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_13);
        __pyx_t_13 = __pyx_t_1;
        __pyx_t_1 = 0;
        while (1) {
          __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_13, __pyx_t_2, &__pyx_t_6, &__pyx_t_1, NULL, NULL, __pyx_t_12);
          if (unlikely(__pyx_t_16 == 0)) break;
          if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 487, __pyx_L38_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 487, __pyx_L38_error)
          __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_k, ((PyObject*)__pyx_t_1));
          __pyx_t_1 = 0;
          if (unlikely(__pyx_v_data_frame == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 487, __pyx_L38_error)
          }
          __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_data_frame, __pyx_8genexpr9__pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L38_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 487, __pyx_L38_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(PyDict_SetItem(__pyx_t_11, (PyObject*)__pyx_8genexpr9__pyx_v_k, (PyObject*)__pyx_t_15))) __PYX_ERR(0, 487, __pyx_L38_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_k); __pyx_8genexpr9__pyx_v_k = 0;
        goto __pyx_L41_exit_scope;
        __pyx_L38_error:;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_k); __pyx_8genexpr9__pyx_v_k = 0;
        goto __pyx_L30_error;
        __pyx_L41_exit_scope:;
      } /* exit inner scope */
      __pyx_v_data_current_step = ((PyObject*)__pyx_t_11);
      __pyx_t_11 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":486
 *         cdef tuple k
 *         cdef dict parsed_data_current_step
 *         try:             # <<<<<<<<<<<<<<
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}
 *         except (TypeError, IndexError):
 */
    }
    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    goto __pyx_L35_try_end;
    __pyx_L30_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":488
 *         try:
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}
 *         except (TypeError, IndexError):             # <<<<<<<<<<<<<<
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 *         for i in range(len(self.c_accounts)):
 */
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_13, &__pyx_t_15) < 0) __PYX_ERR(0, 488, __pyx_L32_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GOTREF(__pyx_t_15);

      /* "trapeza/strategy/fx_strategy.pyx":489
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}
 *         except (TypeError, IndexError):
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}             # <<<<<<<<<<<<<<
 *         for i in range(len(self.c_accounts)):
 *             try:
 */
      { /* enter inner scope */
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = 0;
        if (unlikely(__pyx_v_data_frame == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
          __PYX_ERR(0, 489, __pyx_L46_error)
        }
        __pyx_t_14 = __Pyx_dict_iterator(__pyx_v_data_frame, 1, __pyx_n_s_keys, (&__pyx_t_6), (&__pyx_t_12)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 489, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_XDECREF(__pyx_t_24);
        __pyx_t_24 = __pyx_t_14;
        __pyx_t_14 = 0;
        while (1) {
          __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_24, __pyx_t_6, &__pyx_t_2, &__pyx_t_14, NULL, NULL, __pyx_t_12);
          if (unlikely(__pyx_t_16 == 0)) break;
          if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 489, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (!(likely(PyTuple_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_14)->tp_name), 0))) __PYX_ERR(0, 489, __pyx_L46_error)
          __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_k, ((PyObject*)__pyx_t_14));
          __pyx_t_14 = 0;
          if (unlikely(__pyx_v_data_frame == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 489, __pyx_L46_error)
          }
          __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_data_frame, __pyx_9genexpr10__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 489, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr10__pyx_v_k, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 489, __pyx_L46_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_k); __pyx_9genexpr10__pyx_v_k = 0;
        goto __pyx_L49_exit_scope;
        __pyx_L46_error:;
        __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_k); __pyx_9genexpr10__pyx_v_k = 0;
        goto __pyx_L32_except_error;
        __pyx_L49_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_data_current_step, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L31_exception_handled;
    }
    goto __pyx_L32_except_error;
    __pyx_L32_except_error:;

    /* "trapeza/strategy/fx_strategy.pyx":486
 *         cdef tuple k
 *         cdef dict parsed_data_current_step
 *         try:             # <<<<<<<<<<<<<<
 *             data_current_step = {k: data_frame[k][-1] for k in data_frame.keys()}
 *         except (TypeError, IndexError):
 */
    __Pyx_XGIVEREF(__pyx_t_22);
    __Pyx_XGIVEREF(__pyx_t_21);
    __Pyx_XGIVEREF(__pyx_t_20);
    __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
    goto __pyx_L1_error;
    __pyx_L31_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_22);
    __Pyx_XGIVEREF(__pyx_t_21);
    __Pyx_XGIVEREF(__pyx_t_20);
    __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
    __pyx_L35_try_end:;
  }

  /* "trapeza/strategy/fx_strategy.pyx":490
 *         except (TypeError, IndexError):
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 *         for i in range(len(self.c_accounts)):             # <<<<<<<<<<<<<<
 *             try:
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 */
  __pyx_t_15 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_15);
  if (unlikely(__pyx_t_15 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 490, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_t_15); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_2 = __pyx_t_6;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_2; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "trapeza/strategy/fx_strategy.pyx":491
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 *         for i in range(len(self.c_accounts)):
 *             try:             # <<<<<<<<<<<<<<
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_22);
      /*try:*/ {

        /* "trapeza/strategy/fx_strategy.pyx":492
 *         for i in range(len(self.c_accounts)):
 *             try:
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}             # <<<<<<<<<<<<<<
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 *                                                                             reference_currency=reference_currency))
 */
        { /* enter inner scope */
          __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 492, __pyx_L62_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_26 = 0;
          __pyx_t_11 = __Pyx_dict_iterator(__pyx_v_data_current_step, 1, __pyx_n_s_items, (&__pyx_t_27), (&__pyx_t_12)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 492, __pyx_L62_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_XDECREF(__pyx_t_13);
          __pyx_t_13 = __pyx_t_11;
          __pyx_t_11 = 0;
          while (1) {
            __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_13, __pyx_t_27, &__pyx_t_26, &__pyx_t_11, &__pyx_t_1, NULL, __pyx_t_12);
            if (unlikely(__pyx_t_16 == 0)) break;
            if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GOTREF(__pyx_t_1);
            if (!(likely(PyTuple_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_11)->tp_name), 0))) __PYX_ERR(0, 492, __pyx_L62_error)
            __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_k, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;
            __pyx_9genexpr11__pyx_v_v = __pyx_t_23;
            if (unlikely(__pyx_9genexpr11__pyx_v_k == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 492, __pyx_L62_error)
            }
            __pyx_t_11 = __Pyx_GetItemInt_Tuple(__pyx_9genexpr11__pyx_v_k, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_encode); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_24);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_11 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_24))) {
              __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_24);
              if (likely(__pyx_t_11)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_24, function);
              }
            }
            __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_24);
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
            if (unlikely(__pyx_9genexpr11__pyx_v_k == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 492, __pyx_L62_error)
            }
            __pyx_t_11 = __Pyx_GetItemInt_Tuple(__pyx_9genexpr11__pyx_v_k, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_11 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
              __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_14);
              if (likely(__pyx_t_11)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_14, function);
              }
            }
            __pyx_t_24 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_24);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_24);
            PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_24);
            __pyx_t_1 = 0;
            __pyx_t_24 = 0;
            __pyx_t_24 = PyFloat_FromDouble(__pyx_9genexpr11__pyx_v_v); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_GOTREF(__pyx_t_24);
            if (unlikely(PyDict_SetItem(__pyx_t_15, (PyObject*)__pyx_t_14, (PyObject*)__pyx_t_24))) __PYX_ERR(0, 492, __pyx_L62_error)
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k); __pyx_9genexpr11__pyx_v_k = 0;
          goto __pyx_L65_exit_scope;
          __pyx_L62_error:;
          __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k); __pyx_9genexpr11__pyx_v_k = 0;
          goto __pyx_L52_error;
          __pyx_L65_exit_scope:;
        } /* exit inner scope */
        __Pyx_XDECREF_SET(__pyx_v_parsed_data_current_step, ((PyObject*)__pyx_t_15));
        __pyx_t_15 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":493
 *             try:
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,             # <<<<<<<<<<<<<<
 *                                                                             reference_currency=reference_currency))
 *             except AttributeError:
 */
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 493, __pyx_L52_error)
        }
        __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_self->c_accounts, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_c_total_balance); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_exchange_rates, __pyx_v_parsed_data_current_step) < 0) __PYX_ERR(0, 493, __pyx_L52_error)

        /* "trapeza/strategy/fx_strategy.pyx":494
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 *                                                                             reference_currency=reference_currency))             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 total_balances.push_back(self.c_accounts[i].total_balance(exchange_rates=data_current_step,
 */
        __pyx_t_24 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_reference_currency); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 494, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_24);
        if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_reference_currency, __pyx_t_24) < 0) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":493
 *             try:
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,             # <<<<<<<<<<<<<<
 *                                                                             reference_currency=reference_currency))
 *             except AttributeError:
 */
        __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L52_error)
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        try {
          __pyx_v_total_balances.push_back(__pyx_t_23);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 493, __pyx_L52_error)
        }

        /* "trapeza/strategy/fx_strategy.pyx":491
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 *         for i in range(len(self.c_accounts)):
 *             try:             # <<<<<<<<<<<<<<
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 */
      }
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      goto __pyx_L59_try_end;
      __pyx_L52_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":495
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 *                                                                             reference_currency=reference_currency))
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 total_balances.push_back(self.c_accounts[i].total_balance(exchange_rates=data_current_step,
 *                                                                           reference_currency=reference_currency.decode()))
 */
      __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_12) {
        __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_24, &__pyx_t_15, &__pyx_t_13) < 0) __PYX_ERR(0, 495, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GOTREF(__pyx_t_13);

        /* "trapeza/strategy/fx_strategy.pyx":496
 *                                                                             reference_currency=reference_currency))
 *             except AttributeError:
 *                 total_balances.push_back(self.c_accounts[i].total_balance(exchange_rates=data_current_step,             # <<<<<<<<<<<<<<
 *                                                                           reference_currency=reference_currency.decode()))
 * 
 */
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 496, __pyx_L54_except_error)
        }
        __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_self->c_accounts, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_total_balance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_exchange_rates, __pyx_v_data_current_step) < 0) __PYX_ERR(0, 496, __pyx_L54_except_error)

        /* "trapeza/strategy/fx_strategy.pyx":497
 *             except AttributeError:
 *                 total_balances.push_back(self.c_accounts[i].total_balance(exchange_rates=data_current_step,
 *                                                                           reference_currency=reference_currency.decode()))             # <<<<<<<<<<<<<<
 * 
 *         cdef double sum_total_balances = 0
 */
        __pyx_t_11 = __Pyx_decode_cpp_string(__pyx_v_reference_currency, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 497, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_reference_currency, __pyx_t_11) < 0) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":496
 *                                                                             reference_currency=reference_currency))
 *             except AttributeError:
 *                 total_balances.push_back(self.c_accounts[i].total_balance(exchange_rates=data_current_step,             # <<<<<<<<<<<<<<
 *                                                                           reference_currency=reference_currency.decode()))
 * 
 */
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L54_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        try {
          __pyx_v_total_balances.push_back(__pyx_t_23);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 496, __pyx_L54_except_error)
        }
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L53_exception_handled;
      }
      goto __pyx_L54_except_error;
      __pyx_L54_except_error:;

      /* "trapeza/strategy/fx_strategy.pyx":491
 *             data_current_step = {k: data_frame[k] for k in data_frame.keys()}
 *         for i in range(len(self.c_accounts)):
 *             try:             # <<<<<<<<<<<<<<
 *                 parsed_data_current_step ={(k[0].encode(), k[1].encode()): v for k, v in data_current_step.items()}
 *                 total_balances.push_back(self.c_accounts[i].c_total_balance(exchange_rates=parsed_data_current_step,
 */
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
      goto __pyx_L1_error;
      __pyx_L53_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
      __pyx_L59_try_end:;
    }
  }

  /* "trapeza/strategy/fx_strategy.pyx":499
 *                                                                           reference_currency=reference_currency.decode()))
 * 
 *         cdef double sum_total_balances = 0             # <<<<<<<<<<<<<<
 *         cdef double sum_positions
 *         cdef vector[double] vec_sum_positions
 */
  __pyx_v_sum_total_balances = 0.0;

  /* "trapeza/strategy/fx_strategy.pyx":504
 *         cdef vector[double] pos
 *         cdef vector[vector[double]] vec_pos
 *         pos.reserve(positions.size())             # <<<<<<<<<<<<<<
 *         vec_pos.reserve(1)
 *         vec_sum_positions.reserve(1)
 */
  __pyx_v_pos.reserve(__pyx_v_positions.size());

  /* "trapeza/strategy/fx_strategy.pyx":505
 *         cdef vector[vector[double]] vec_pos
 *         pos.reserve(positions.size())
 *         vec_pos.reserve(1)             # <<<<<<<<<<<<<<
 *         vec_sum_positions.reserve(1)
 *         if append_to_results:
 */
  __pyx_v_vec_pos.reserve(1);

  /* "trapeza/strategy/fx_strategy.pyx":506
 *         pos.reserve(positions.size())
 *         vec_pos.reserve(1)
 *         vec_sum_positions.reserve(1)             # <<<<<<<<<<<<<<
 *         if append_to_results:
 *             self._c_signals_at_step_t.clear()
 */
  __pyx_v_vec_sum_positions.reserve(1);

  /* "trapeza/strategy/fx_strategy.pyx":507
 *         vec_pos.reserve(1)
 *         vec_sum_positions.reserve(1)
 *         if append_to_results:             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t.clear()
 *             # self._c_signals_at_step_t = dict()
 */
  __pyx_t_10 = (__pyx_v_append_to_results != 0);
  if (__pyx_t_10) {

    /* "trapeza/strategy/fx_strategy.pyx":508
 *         vec_sum_positions.reserve(1)
 *         if append_to_results:
 *             self._c_signals_at_step_t.clear()             # <<<<<<<<<<<<<<
 *             # self._c_signals_at_step_t = dict()
 *             self.c_signals.push_back(signals)
 */
    __pyx_v_self->_c_signals_at_step_t.clear();

    /* "trapeza/strategy/fx_strategy.pyx":510
 *             self._c_signals_at_step_t.clear()
 *             # self._c_signals_at_step_t = dict()
 *             self.c_signals.push_back(signals)             # <<<<<<<<<<<<<<
 *             self.c_total_balances.push_back(total_balances)
 * 
 */
    try {
      __pyx_v_self->c_signals.push_back(__pyx_v_signals);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 510, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":511
 *             # self._c_signals_at_step_t = dict()
 *             self.c_signals.push_back(signals)
 *             self.c_total_balances.push_back(total_balances)             # <<<<<<<<<<<<<<
 * 
 *             for i in range(total_balances.size()):
 */
    try {
      __pyx_v_self->c_total_balances.push_back(__pyx_v_total_balances);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 511, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":513
 *             self.c_total_balances.push_back(total_balances)
 * 
 *             for i in range(total_balances.size()):             # <<<<<<<<<<<<<<
 *                 sum_total_balances = c_precision_add(sum_total_balances, total_balances[i])
 *             self.c_merged_total_balances.push_back(sum_total_balances)
 */
    __pyx_t_28 = __pyx_v_total_balances.size();
    __pyx_t_29 = __pyx_t_28;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_29; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "trapeza/strategy/fx_strategy.pyx":514
 * 
 *             for i in range(total_balances.size()):
 *                 sum_total_balances = c_precision_add(sum_total_balances, total_balances[i])             # <<<<<<<<<<<<<<
 *             self.c_merged_total_balances.push_back(sum_total_balances)
 *             for currency in all_currencies:
 */
      __pyx_v_sum_total_balances = __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_add(__pyx_v_sum_total_balances, (__pyx_v_total_balances[__pyx_v_i]));
    }

    /* "trapeza/strategy/fx_strategy.pyx":515
 *             for i in range(total_balances.size()):
 *                 sum_total_balances = c_precision_add(sum_total_balances, total_balances[i])
 *             self.c_merged_total_balances.push_back(sum_total_balances)             # <<<<<<<<<<<<<<
 *             for currency in all_currencies:
 *                 pos.clear()
 */
    try {
      __pyx_v_self->c_merged_total_balances.push_back(__pyx_v_sum_total_balances);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 515, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":516
 *                 sum_total_balances = c_precision_add(sum_total_balances, total_balances[i])
 *             self.c_merged_total_balances.push_back(sum_total_balances)
 *             for currency in all_currencies:             # <<<<<<<<<<<<<<
 *                 pos.clear()
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 */
    __pyx_t_18 = __pyx_v_all_currencies.begin();
    for (;;) {
      if (!(__pyx_t_18 != __pyx_v_all_currencies.end())) break;
      __pyx_t_19 = *__pyx_t_18;
      ++__pyx_t_18;
      __pyx_v_currency = __pyx_t_19;

      /* "trapeza/strategy/fx_strategy.pyx":517
 *             self.c_merged_total_balances.push_back(sum_total_balances)
 *             for currency in all_currencies:
 *                 pos.clear()             # <<<<<<<<<<<<<<
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 *                 for dict_acc in positions:
 */
      __pyx_v_pos.clear();

      /* "trapeza/strategy/fx_strategy.pyx":519
 *                 pos.clear()
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 *                 for dict_acc in positions:             # <<<<<<<<<<<<<<
 *                     pos.push_back(dict_acc[currency])
 *                 try:
 */
      __pyx_t_30 = __pyx_v_positions.begin();
      for (;;) {
        if (!(__pyx_t_30 != __pyx_v_positions.end())) break;
        __pyx_t_31 = *__pyx_t_30;
        ++__pyx_t_30;
        __pyx_v_dict_acc = __pyx_t_31;

        /* "trapeza/strategy/fx_strategy.pyx":520
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 *                 for dict_acc in positions:
 *                     pos.push_back(dict_acc[currency])             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.c_positions[currency].push_back(pos)
 */
        try {
          __pyx_v_pos.push_back((__pyx_v_dict_acc[__pyx_v_currency]));
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 520, __pyx_L1_error)
        }

        /* "trapeza/strategy/fx_strategy.pyx":519
 *                 pos.clear()
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 *                 for dict_acc in positions:             # <<<<<<<<<<<<<<
 *                     pos.push_back(dict_acc[currency])
 *                 try:
 */
      }

      /* "trapeza/strategy/fx_strategy.pyx":521
 *                 for dict_acc in positions:
 *                     pos.push_back(dict_acc[currency])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_positions[currency].push_back(pos)
 *                 except KeyError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_20);
        /*try:*/ {

          /* "trapeza/strategy/fx_strategy.pyx":522
 *                     pos.push_back(dict_acc[currency])
 *                 try:
 *                     self.c_positions[currency].push_back(pos)             # <<<<<<<<<<<<<<
 *                 except KeyError:
 *                     vec_pos.clear()
 */
          try {
            (__pyx_v_self->c_positions[__pyx_v_currency]).push_back(__pyx_v_pos);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 522, __pyx_L75_error)
          }

          /* "trapeza/strategy/fx_strategy.pyx":521
 *                 for dict_acc in positions:
 *                     pos.push_back(dict_acc[currency])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_positions[currency].push_back(pos)
 *                 except KeyError:
 */
        }
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        goto __pyx_L82_try_end;
        __pyx_L75_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":523
 *                 try:
 *                     self.c_positions[currency].push_back(pos)
 *                 except KeyError:             # <<<<<<<<<<<<<<
 *                     vec_pos.clear()
 *                     vec_pos.push_back(pos)
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_15, &__pyx_t_24) < 0) __PYX_ERR(0, 523, __pyx_L77_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GOTREF(__pyx_t_24);

          /* "trapeza/strategy/fx_strategy.pyx":524
 *                     self.c_positions[currency].push_back(pos)
 *                 except KeyError:
 *                     vec_pos.clear()             # <<<<<<<<<<<<<<
 *                     vec_pos.push_back(pos)
 *                     self.c_positions[currency] = vec_pos
 */
          __pyx_v_vec_pos.clear();

          /* "trapeza/strategy/fx_strategy.pyx":525
 *                 except KeyError:
 *                     vec_pos.clear()
 *                     vec_pos.push_back(pos)             # <<<<<<<<<<<<<<
 *                     self.c_positions[currency] = vec_pos
 * 
 */
          try {
            __pyx_v_vec_pos.push_back(__pyx_v_pos);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 525, __pyx_L77_except_error)
          }

          /* "trapeza/strategy/fx_strategy.pyx":526
 *                     vec_pos.clear()
 *                     vec_pos.push_back(pos)
 *                     self.c_positions[currency] = vec_pos             # <<<<<<<<<<<<<<
 * 
 *                 sum_positions = 0
 */
          (__pyx_v_self->c_positions[__pyx_v_currency]) = __pyx_v_vec_pos;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
          goto __pyx_L76_exception_handled;
        }
        goto __pyx_L77_except_error;
        __pyx_L77_except_error:;

        /* "trapeza/strategy/fx_strategy.pyx":521
 *                 for dict_acc in positions:
 *                     pos.push_back(dict_acc[currency])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_positions[currency].push_back(pos)
 *                 except KeyError:
 */
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        goto __pyx_L1_error;
        __pyx_L76_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        __pyx_L82_try_end:;
      }

      /* "trapeza/strategy/fx_strategy.pyx":528
 *                     self.c_positions[currency] = vec_pos
 * 
 *                 sum_positions = 0             # <<<<<<<<<<<<<<
 *                 for i in range(pos.size()):
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 */
      __pyx_v_sum_positions = 0.0;

      /* "trapeza/strategy/fx_strategy.pyx":529
 * 
 *                 sum_positions = 0
 *                 for i in range(pos.size()):             # <<<<<<<<<<<<<<
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 *                 try:
 */
      __pyx_t_28 = __pyx_v_pos.size();
      __pyx_t_29 = __pyx_t_28;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_29; __pyx_t_7+=1) {
        __pyx_v_i = __pyx_t_7;

        /* "trapeza/strategy/fx_strategy.pyx":530
 *                 sum_positions = 0
 *                 for i in range(pos.size()):
 *                     sum_positions = c_precision_add(sum_positions, pos[i])             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 */
        __pyx_v_sum_positions = __pyx_v_7trapeza_11arithmetics_11arithmetics_c_precision_add(__pyx_v_sum_positions, (__pyx_v_pos[__pyx_v_i]));
      }

      /* "trapeza/strategy/fx_strategy.pyx":531
 *                 for i in range(pos.size()):
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 *                 except KeyError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_22);
        /*try:*/ {

          /* "trapeza/strategy/fx_strategy.pyx":532
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 *                 try:
 *                     self.c_merged_positions[currency].push_back(sum_positions)             # <<<<<<<<<<<<<<
 *                 except KeyError:
 *                     vec_sum_positions.clear()
 */
          try {
            (__pyx_v_self->c_merged_positions[__pyx_v_currency]).push_back(__pyx_v_sum_positions);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 532, __pyx_L87_error)
          }

          /* "trapeza/strategy/fx_strategy.pyx":531
 *                 for i in range(pos.size()):
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 *                 except KeyError:
 */
        }
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L94_try_end;
        __pyx_L87_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":533
 *                 try:
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 *                 except KeyError:             # <<<<<<<<<<<<<<
 *                     vec_sum_positions.clear()
 *                     vec_sum_positions.push_back(sum_positions)
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_24, &__pyx_t_15, &__pyx_t_13) < 0) __PYX_ERR(0, 533, __pyx_L89_except_error)
          __Pyx_GOTREF(__pyx_t_24);
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GOTREF(__pyx_t_13);

          /* "trapeza/strategy/fx_strategy.pyx":534
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 *                 except KeyError:
 *                     vec_sum_positions.clear()             # <<<<<<<<<<<<<<
 *                     vec_sum_positions.push_back(sum_positions)
 *                     self.c_merged_positions[currency] = vec_sum_positions
 */
          __pyx_v_vec_sum_positions.clear();

          /* "trapeza/strategy/fx_strategy.pyx":535
 *                 except KeyError:
 *                     vec_sum_positions.clear()
 *                     vec_sum_positions.push_back(sum_positions)             # <<<<<<<<<<<<<<
 *                     self.c_merged_positions[currency] = vec_sum_positions
 * 
 */
          try {
            __pyx_v_vec_sum_positions.push_back(__pyx_v_sum_positions);
          } catch(...) {
            __Pyx_CppExn2PyErr();
            __PYX_ERR(0, 535, __pyx_L89_except_error)
          }

          /* "trapeza/strategy/fx_strategy.pyx":536
 *                     vec_sum_positions.clear()
 *                     vec_sum_positions.push_back(sum_positions)
 *                     self.c_merged_positions[currency] = vec_sum_positions             # <<<<<<<<<<<<<<
 * 
 *         # vector[vector[string]], vector[unordered_map[string, double]], vector[double]
 */
          (__pyx_v_self->c_merged_positions[__pyx_v_currency]) = __pyx_v_vec_sum_positions;
          __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L88_exception_handled;
        }
        goto __pyx_L89_except_error;
        __pyx_L89_except_error:;

        /* "trapeza/strategy/fx_strategy.pyx":531
 *                 for i in range(pos.size()):
 *                     sum_positions = c_precision_add(sum_positions, pos[i])
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.c_merged_positions[currency].push_back(sum_positions)
 *                 except KeyError:
 */
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        goto __pyx_L1_error;
        __pyx_L88_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        __pyx_L94_try_end:;
      }

      /* "trapeza/strategy/fx_strategy.pyx":516
 *                 sum_total_balances = c_precision_add(sum_total_balances, total_balances[i])
 *             self.c_merged_total_balances.push_back(sum_total_balances)
 *             for currency in all_currencies:             # <<<<<<<<<<<<<<
 *                 pos.clear()
 *                 # pos = [dict_acc[currency] for dict_acc in positions]
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":507
 *         vec_pos.reserve(1)
 *         vec_sum_positions.reserve(1)
 *         if append_to_results:             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t.clear()
 *             # self._c_signals_at_step_t = dict()
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":539
 * 
 *         # vector[vector[string]], vector[unordered_map[string, double]], vector[double]
 *         ret_signals[0] = signals             # <<<<<<<<<<<<<<
 *         ret_positions[0] = positions
 *         ret_total_balances[0] = total_balances
 */
  (__pyx_v_ret_signals[0]) = __pyx_v_signals;

  /* "trapeza/strategy/fx_strategy.pyx":540
 *         # vector[vector[string]], vector[unordered_map[string, double]], vector[double]
 *         ret_signals[0] = signals
 *         ret_positions[0] = positions             # <<<<<<<<<<<<<<
 *         ret_total_balances[0] = total_balances
 *         return 1
 */
  (__pyx_v_ret_positions[0]) = __pyx_v_positions;

  /* "trapeza/strategy/fx_strategy.pyx":541
 *         ret_signals[0] = signals
 *         ret_positions[0] = positions
 *         ret_total_balances[0] = total_balances             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  (__pyx_v_ret_total_balances[0]) = __pyx_v_total_balances;

  /* "trapeza/strategy/fx_strategy.pyx":542
 *         ret_positions[0] = positions
 *         ret_total_balances[0] = total_balances
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":432
 *         return 1
 * 
 *     cdef short c_evaluate(self, dict data_frame, string reference_currency, bool_t append_to_results,             # <<<<<<<<<<<<<<
 *                           vector[vector[string]] *ret_signals, vector[unordered_map[string, double]] *ret_positions,
 *                           vector[double] *ret_total_balances) except -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data_current_step);
  __Pyx_XDECREF(__pyx_v_parsed_data_current_step);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_u);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_k);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":546
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef tuple c_wrap_evaluate(self, dict data_frame, string reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Serves as wrapper between self.c_evaluate and FXStrategy.evaluate.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_35c_wrap_evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, PyObject *__pyx_v_append_to_results, int __pyx_skip_dispatch) {
  std::vector<std::vector<std::string> >  __pyx_v_signals;
  std::vector<std::unordered_map<std::string,double> >  __pyx_v_positions;
  std::vector<double>  __pyx_v_total_balances;
  PyObject *__pyx_v_ret_signals = 0;
  PyObject *__pyx_v_ret_inner_signals = 0;
  std::vector<std::string>  __pyx_v_outer_signal;
  std::string __pyx_v_inner_signal;
  PyObject *__pyx_v_ret_positions = 0;
  PyObject *__pyx_v_ret_inner_positions = 0;
  std::unordered_map<std::string,double>  __pyx_v_outer_position;
  std::pair<std::string,double>  __pyx_v_inner_position;
  PyObject *__pyx_v_ret_total_balances = 0;
  double __pyx_v_tb;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  bool __pyx_t_9;
  short __pyx_t_10;
  std::vector<std::vector<std::string> > ::iterator __pyx_t_11;
  std::vector<std::string>  __pyx_t_12;
  std::vector<std::string> ::iterator __pyx_t_13;
  std::string __pyx_t_14;
  int __pyx_t_15;
  std::vector<std::unordered_map<std::string,double> > ::iterator __pyx_t_16;
  std::unordered_map<std::string,double>  __pyx_t_17;
  std::unordered_map<std::string,double> ::iterator __pyx_t_18;
  std::pair<std::string,double>  __pyx_t_19;
  std::vector<double> ::iterator __pyx_t_20;
  double __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_wrap_evaluate", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_wrap_evaluate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_35c_wrap_evaluate)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_reference_currency); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_data_frame, __pyx_t_3, __pyx_v_append_to_results};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_data_frame, __pyx_t_3, __pyx_v_append_to_results};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_data_frame);
          __Pyx_GIVEREF(__pyx_v_data_frame);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_data_frame);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
          __Pyx_INCREF(__pyx_v_append_to_results);
          __Pyx_GIVEREF(__pyx_v_append_to_results);
          PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_append_to_results);
          __pyx_t_3 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 546, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":558
 *         cdef vector[unordered_map[string, double]] positions
 *         cdef vector[double] total_balances
 *         signals.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         positions.reserve(len(self.c_accounts))
 *         total_balances.reserve(len(self.c_accounts))
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 558, __pyx_L1_error)
  }
  __pyx_t_8 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_signals.reserve(__pyx_t_8);

  /* "trapeza/strategy/fx_strategy.pyx":559
 *         cdef vector[double] total_balances
 *         signals.reserve(len(self.c_accounts))
 *         positions.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         total_balances.reserve(len(self.c_accounts))
 * 
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 559, __pyx_L1_error)
  }
  __pyx_t_8 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_positions.reserve(__pyx_t_8);

  /* "trapeza/strategy/fx_strategy.pyx":560
 *         signals.reserve(len(self.c_accounts))
 *         positions.reserve(len(self.c_accounts))
 *         total_balances.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 * 
 *         self.c_evaluate(data_frame, reference_currency, append_to_results, &signals, &positions, &total_balances)
 */
  __pyx_t_1 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 560, __pyx_L1_error)
  }
  __pyx_t_8 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_total_balances.reserve(__pyx_t_8);

  /* "trapeza/strategy/fx_strategy.pyx":562
 *         total_balances.reserve(len(self.c_accounts))
 * 
 *         self.c_evaluate(data_frame, reference_currency, append_to_results, &signals, &positions, &total_balances)             # <<<<<<<<<<<<<<
 * 
 *         cdef list ret_signals = []
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_append_to_results); if (unlikely((__pyx_t_9 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error)
  __pyx_t_10 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->c_evaluate(__pyx_v_self, __pyx_v_data_frame, __pyx_v_reference_currency, __pyx_t_9, (&__pyx_v_signals), (&__pyx_v_positions), (&__pyx_v_total_balances)); if (unlikely(__pyx_t_10 == ((short)-1))) __PYX_ERR(0, 562, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":564
 *         self.c_evaluate(data_frame, reference_currency, append_to_results, &signals, &positions, &total_balances)
 * 
 *         cdef list ret_signals = []             # <<<<<<<<<<<<<<
 *         cdef list ret_inner_signals
 *         for outer_signal in signals:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_signals = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":566
 *         cdef list ret_signals = []
 *         cdef list ret_inner_signals
 *         for outer_signal in signals:             # <<<<<<<<<<<<<<
 *             ret_inner_signals = []
 *             for inner_signal in outer_signal:
 */
  __pyx_t_11 = __pyx_v_signals.begin();
  for (;;) {
    if (!(__pyx_t_11 != __pyx_v_signals.end())) break;
    __pyx_t_12 = *__pyx_t_11;
    ++__pyx_t_11;
    __pyx_v_outer_signal = __pyx_t_12;

    /* "trapeza/strategy/fx_strategy.pyx":567
 *         cdef list ret_inner_signals
 *         for outer_signal in signals:
 *             ret_inner_signals = []             # <<<<<<<<<<<<<<
 *             for inner_signal in outer_signal:
 *                 ret_inner_signals.append(inner_signal.decode())
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_inner_signals, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":568
 *         for outer_signal in signals:
 *             ret_inner_signals = []
 *             for inner_signal in outer_signal:             # <<<<<<<<<<<<<<
 *                 ret_inner_signals.append(inner_signal.decode())
 *             ret_signals.append(ret_inner_signals)
 */
    __pyx_t_13 = __pyx_v_outer_signal.begin();
    for (;;) {
      if (!(__pyx_t_13 != __pyx_v_outer_signal.end())) break;
      __pyx_t_14 = *__pyx_t_13;
      ++__pyx_t_13;
      __pyx_v_inner_signal = __pyx_t_14;

      /* "trapeza/strategy/fx_strategy.pyx":569
 *             ret_inner_signals = []
 *             for inner_signal in outer_signal:
 *                 ret_inner_signals.append(inner_signal.decode())             # <<<<<<<<<<<<<<
 *             ret_signals.append(ret_inner_signals)
 * 
 */
      __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_inner_signal, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_ret_inner_signals, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 569, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":568
 *         for outer_signal in signals:
 *             ret_inner_signals = []
 *             for inner_signal in outer_signal:             # <<<<<<<<<<<<<<
 *                 ret_inner_signals.append(inner_signal.decode())
 *             ret_signals.append(ret_inner_signals)
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":570
 *             for inner_signal in outer_signal:
 *                 ret_inner_signals.append(inner_signal.decode())
 *             ret_signals.append(ret_inner_signals)             # <<<<<<<<<<<<<<
 * 
 *         cdef list ret_positions = []
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_ret_signals, __pyx_v_ret_inner_signals); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 570, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":566
 *         cdef list ret_signals = []
 *         cdef list ret_inner_signals
 *         for outer_signal in signals:             # <<<<<<<<<<<<<<
 *             ret_inner_signals = []
 *             for inner_signal in outer_signal:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":572
 *             ret_signals.append(ret_inner_signals)
 * 
 *         cdef list ret_positions = []             # <<<<<<<<<<<<<<
 *         cdef dict ret_inner_positions
 *         for outer_position in positions:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_positions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":574
 *         cdef list ret_positions = []
 *         cdef dict ret_inner_positions
 *         for outer_position in positions:             # <<<<<<<<<<<<<<
 *             ret_inner_positions = {}
 *             for inner_position in outer_position:
 */
  __pyx_t_16 = __pyx_v_positions.begin();
  for (;;) {
    if (!(__pyx_t_16 != __pyx_v_positions.end())) break;
    __pyx_t_17 = *__pyx_t_16;
    ++__pyx_t_16;
    __pyx_v_outer_position = __pyx_t_17;

    /* "trapeza/strategy/fx_strategy.pyx":575
 *         cdef dict ret_inner_positions
 *         for outer_position in positions:
 *             ret_inner_positions = {}             # <<<<<<<<<<<<<<
 *             for inner_position in outer_position:
 *                 ret_inner_positions[inner_position.first.decode()] = inner_position.second
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_ret_inner_positions, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":576
 *         for outer_position in positions:
 *             ret_inner_positions = {}
 *             for inner_position in outer_position:             # <<<<<<<<<<<<<<
 *                 ret_inner_positions[inner_position.first.decode()] = inner_position.second
 *             ret_positions.append(ret_inner_positions)
 */
    __pyx_t_18 = __pyx_v_outer_position.begin();
    for (;;) {
      if (!(__pyx_t_18 != __pyx_v_outer_position.end())) break;
      __pyx_t_19 = *__pyx_t_18;
      ++__pyx_t_18;
      __pyx_v_inner_position = __pyx_t_19;

      /* "trapeza/strategy/fx_strategy.pyx":577
 *             ret_inner_positions = {}
 *             for inner_position in outer_position:
 *                 ret_inner_positions[inner_position.first.decode()] = inner_position.second             # <<<<<<<<<<<<<<
 *             ret_positions.append(ret_inner_positions)
 * 
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_inner_position.second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_v_inner_position.first, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyDict_SetItem(__pyx_v_ret_inner_positions, __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 577, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":576
 *         for outer_position in positions:
 *             ret_inner_positions = {}
 *             for inner_position in outer_position:             # <<<<<<<<<<<<<<
 *                 ret_inner_positions[inner_position.first.decode()] = inner_position.second
 *             ret_positions.append(ret_inner_positions)
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":578
 *             for inner_position in outer_position:
 *                 ret_inner_positions[inner_position.first.decode()] = inner_position.second
 *             ret_positions.append(ret_inner_positions)             # <<<<<<<<<<<<<<
 * 
 *         cdef list ret_total_balances = []
 */
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_ret_positions, __pyx_v_ret_inner_positions); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 578, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":574
 *         cdef list ret_positions = []
 *         cdef dict ret_inner_positions
 *         for outer_position in positions:             # <<<<<<<<<<<<<<
 *             ret_inner_positions = {}
 *             for inner_position in outer_position:
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":580
 *             ret_positions.append(ret_inner_positions)
 * 
 *         cdef list ret_total_balances = []             # <<<<<<<<<<<<<<
 *         for tb in total_balances:
 *             ret_total_balances.append(tb)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_total_balances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":581
 * 
 *         cdef list ret_total_balances = []
 *         for tb in total_balances:             # <<<<<<<<<<<<<<
 *             ret_total_balances.append(tb)
 * 
 */
  __pyx_t_20 = __pyx_v_total_balances.begin();
  for (;;) {
    if (!(__pyx_t_20 != __pyx_v_total_balances.end())) break;
    __pyx_t_21 = *__pyx_t_20;
    ++__pyx_t_20;
    __pyx_v_tb = __pyx_t_21;

    /* "trapeza/strategy/fx_strategy.pyx":582
 *         cdef list ret_total_balances = []
 *         for tb in total_balances:
 *             ret_total_balances.append(tb)             # <<<<<<<<<<<<<<
 * 
 *         return ret_signals, ret_positions, ret_total_balances
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_ret_total_balances, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 582, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":581
 * 
 *         cdef list ret_total_balances = []
 *         for tb in total_balances:             # <<<<<<<<<<<<<<
 *             ret_total_balances.append(tb)
 * 
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":584
 *             ret_total_balances.append(tb)
 * 
 *         return ret_signals, ret_positions, ret_total_balances             # <<<<<<<<<<<<<<
 * 
 *     @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_ret_signals);
  __Pyx_GIVEREF(__pyx_v_ret_signals);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ret_signals);
  __Pyx_INCREF(__pyx_v_ret_positions);
  __Pyx_GIVEREF(__pyx_v_ret_positions);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ret_positions);
  __Pyx_INCREF(__pyx_v_ret_total_balances);
  __Pyx_GIVEREF(__pyx_v_ret_total_balances);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_ret_total_balances);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":546
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef tuple c_wrap_evaluate(self, dict data_frame, string reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Serves as wrapper between self.c_evaluate and FXStrategy.evaluate.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_signals);
  __Pyx_XDECREF(__pyx_v_ret_inner_signals);
  __Pyx_XDECREF(__pyx_v_ret_positions);
  __Pyx_XDECREF(__pyx_v_ret_inner_positions);
  __Pyx_XDECREF(__pyx_v_ret_total_balances);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_35c_wrap_evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_34c_wrap_evaluate[] = "\n        Serves as wrapper between self.c_evaluate and FXStrategy.evaluate.\n        See docstrings of self.c_evaluate and FXStrategy.evaluate for further details.\n        :param data_frame: dict, see FXStrategy.evaluate for further details\n        :param reference_currency: std:string\n        :param append_to_results: std:bool, appends results to internal storage if True\n        :return: \n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_35c_wrap_evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data_frame = 0;
  std::string __pyx_v_reference_currency;
  PyObject *__pyx_v_append_to_results = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_wrap_evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data_frame,&__pyx_n_s_reference_currency,&__pyx_n_s_append_to_results,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_frame)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reference_currency)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_wrap_evaluate", 1, 3, 3, 1); __PYX_ERR(0, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_append_to_results)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_wrap_evaluate", 1, 3, 3, 2); __PYX_ERR(0, 546, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_wrap_evaluate") < 0)) __PYX_ERR(0, 546, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_data_frame = ((PyObject*)values[0]);
    __pyx_v_reference_currency = __pyx_convert_string_from_py_std__in_string(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L3_error)
    __pyx_v_append_to_results = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("c_wrap_evaluate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 546, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data_frame), (&PyDict_Type), 1, "data_frame", 1))) __PYX_ERR(0, 546, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_34c_wrap_evaluate(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), __pyx_v_data_frame, __pyx_v_reference_currency, __pyx_v_append_to_results);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_34c_wrap_evaluate(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_data_frame, std::string __pyx_v_reference_currency, PyObject *__pyx_v_append_to_results) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_wrap_evaluate", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_evaluate(__pyx_v_self, __pyx_v_data_frame, __pyx_v_reference_currency, __pyx_v_append_to_results, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":587
 * 
 *     @cython.wraparound(False)
 *     cpdef short c_add_signal(self, long i, string signal) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Add signals to temporary container self._c_signals_at_step_t.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_37c_add_signal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_add_signal(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, long __pyx_v_i, std::string __pyx_v_signal, int __pyx_skip_dispatch) {
  std::vector<std::string>  __pyx_v_vec;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  short __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_add_signal", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_add_signal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_37c_add_signal)) {
        __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_signal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = __Pyx_PyInt_As_short(__pyx_t_2); if (unlikely((__pyx_t_9 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_9;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":596
 *         """
 *         cdef vector[string] vec
 *         vec.reserve(1)             # <<<<<<<<<<<<<<
 *         if self._c_signals_at_step_t.count(i) == 1:
 *             self._c_signals_at_step_t[i].push_back(signal)
 */
  __pyx_v_vec.reserve(1);

  /* "trapeza/strategy/fx_strategy.pyx":597
 *         cdef vector[string] vec
 *         vec.reserve(1)
 *         if self._c_signals_at_step_t.count(i) == 1:             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t[i].push_back(signal)
 *         else:
 */
  __pyx_t_10 = ((__pyx_v_self->_c_signals_at_step_t.count(__pyx_v_i) == 1) != 0);
  if (__pyx_t_10) {

    /* "trapeza/strategy/fx_strategy.pyx":598
 *         vec.reserve(1)
 *         if self._c_signals_at_step_t.count(i) == 1:
 *             self._c_signals_at_step_t[i].push_back(signal)             # <<<<<<<<<<<<<<
 *         else:
 *             vec.push_back(signal)
 */
    try {
      (__pyx_v_self->_c_signals_at_step_t[__pyx_v_i]).push_back(__pyx_v_signal);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 598, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":597
 *         cdef vector[string] vec
 *         vec.reserve(1)
 *         if self._c_signals_at_step_t.count(i) == 1:             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t[i].push_back(signal)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "trapeza/strategy/fx_strategy.pyx":600
 *             self._c_signals_at_step_t[i].push_back(signal)
 *         else:
 *             vec.push_back(signal)             # <<<<<<<<<<<<<<
 *             self._c_signals_at_step_t[i] = vec
 *             # self._signals_at_step_t[i] = []
 */
  /*else*/ {
    try {
      __pyx_v_vec.push_back(__pyx_v_signal);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 600, __pyx_L1_error)
    }

    /* "trapeza/strategy/fx_strategy.pyx":601
 *         else:
 *             vec.push_back(signal)
 *             self._c_signals_at_step_t[i] = vec             # <<<<<<<<<<<<<<
 *             # self._signals_at_step_t[i] = []
 *             # self._signals_at_step_t[i].append(signal)
 */
    (__pyx_v_self->_c_signals_at_step_t[__pyx_v_i]) = __pyx_v_vec;
  }
  __pyx_L3:;

  /* "trapeza/strategy/fx_strategy.pyx":604
 *             # self._signals_at_step_t[i] = []
 *             # self._signals_at_step_t[i].append(signal)
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.wraparound(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":587
 * 
 *     @cython.wraparound(False)
 *     cpdef short c_add_signal(self, long i, string signal) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Add signals to temporary container self._c_signals_at_step_t.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_37c_add_signal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_36c_add_signal[] = "\n        Add signals to temporary container self._c_signals_at_step_t.\n        Gets wrapped by FXStrategy.\n        :param i: index position of account in self.c_accounts\n        :param signal: std:string, signals of account i emitted at current time step\n        :return: 1\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_37c_add_signal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_i;
  std::string __pyx_v_signal;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_add_signal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_i,&__pyx_n_s_signal,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_add_signal", 1, 2, 2, 1); __PYX_ERR(0, 587, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_add_signal") < 0)) __PYX_ERR(0, 587, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_i = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_i == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L3_error)
    __pyx_v_signal = __pyx_convert_string_from_py_std__in_string(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("c_add_signal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_36c_add_signal(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), __pyx_v_i, __pyx_v_signal);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_36c_add_signal(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, long __pyx_v_i, std::string __pyx_v_signal) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_add_signal", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_add_signal(__pyx_v_self, __pyx_v_i, __pyx_v_signal, 1); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 587, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":607
 * 
 *     @cython.wraparound(False)
 *     cdef short c_run(self, dict price_data, string reference_currency, dict volume_data, long len_data,             # <<<<<<<<<<<<<<
 *                      vector[vector[vector[string]]] *ret_signals,
 *                      unordered_map[string, vector[vector[double]]] *ret_positions,
 */

static short __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data, std::vector<std::vector<std::vector<std::string> > >  *__pyx_v_ret_signals, std::unordered_map<std::string,std::vector<std::vector<double> > >  *__pyx_v_ret_positions, std::unordered_map<std::string,std::vector<double> >  *__pyx_v_ret_merged_positions, std::vector<std::vector<double> >  *__pyx_v_ret_total_balances, std::vector<double>  *__pyx_v_ret_merged_total_balances) {
  PyObject *__pyx_v_all_price_pairs = 0;
  PyObject *__pyx_v_all_volume_pairs = 0;
  std::vector<std::vector<std::string> >  __pyx_v_signals;
  std::vector<std::unordered_map<std::string,double> >  __pyx_v_positions;
  std::vector<double>  __pyx_v_total_balances;
  std::vector<long>  __pyx_v_current_clocks;
  std::vector<long>  __pyx_v_new_clocks;
  long __pyx_v_i;
  PyObject *__pyx_v_price_data_point = 0;
  PyObject *__pyx_v_volume_data_point = 0;
  PyObject *__pyx_9genexpr12__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr16__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr17__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr18__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_acc = NULL;
  PyObject *__pyx_9genexpr21__pyx_v_acc = NULL;
  short __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  short __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  std::vector<long>  __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  long __pyx_t_15;
  long __pyx_t_16;
  long __pyx_t_17;
  int __pyx_t_18;
  std::vector<std::vector<std::vector<std::string> > >  __pyx_t_19;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_t_20;
  std::unordered_map<std::string,std::vector<double> >  __pyx_t_21;
  std::vector<std::vector<double> >  __pyx_t_22;
  std::vector<double>  __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_run", 0);

  /* "trapeza/strategy/fx_strategy.pyx":634
 *         cdef list all_price_pairs
 *         cdef list all_volume_pairs
 *         all_price_pairs = list(price_data.keys())             # <<<<<<<<<<<<<<
 *         if len(volume_data) > 0:
 *             all_volume_pairs = list(volume_data.keys())
 */
  if (unlikely(__pyx_v_price_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 634, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_price_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_all_price_pairs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":635
 *         cdef list all_volume_pairs
 *         all_price_pairs = list(price_data.keys())
 *         if len(volume_data) > 0:             # <<<<<<<<<<<<<<
 *             all_volume_pairs = list(volume_data.keys())
 *         else:
 */
  if (unlikely(__pyx_v_volume_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 635, __pyx_L1_error)
  }
  __pyx_t_3 = PyDict_Size(__pyx_v_volume_data); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 635, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 0) != 0);
  if (__pyx_t_4) {

    /* "trapeza/strategy/fx_strategy.pyx":636
 *         all_price_pairs = list(price_data.keys())
 *         if len(volume_data) > 0:
 *             all_volume_pairs = list(volume_data.keys())             # <<<<<<<<<<<<<<
 *         else:
 *             all_volume_pairs = []
 */
    if (unlikely(__pyx_v_volume_data == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
      __PYX_ERR(0, 636, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_Keys(__pyx_v_volume_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_all_volume_pairs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":635
 *         cdef list all_volume_pairs
 *         all_price_pairs = list(price_data.keys())
 *         if len(volume_data) > 0:             # <<<<<<<<<<<<<<
 *             all_volume_pairs = list(volume_data.keys())
 *         else:
 */
    goto __pyx_L3;
  }

  /* "trapeza/strategy/fx_strategy.pyx":638
 *             all_volume_pairs = list(volume_data.keys())
 *         else:
 *             all_volume_pairs = []             # <<<<<<<<<<<<<<
 * 
 *         # >>>reset account and storage
 */
  /*else*/ {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_all_volume_pairs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "trapeza/strategy/fx_strategy.pyx":641
 * 
 *         # >>>reset account and storage
 *         self.c_reset()             # <<<<<<<<<<<<<<
 * 
 *         # prepare storage
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->c_reset(__pyx_v_self, 0); if (unlikely(__pyx_t_5 == ((short)-1))) __PYX_ERR(0, 641, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":644
 * 
 *         # prepare storage
 *         self._c_init_all_positions(list(price_data.keys()))             # <<<<<<<<<<<<<<
 * 
 *         # >>>execute strategy
 */
  if (unlikely(__pyx_v_price_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 644, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_price_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->_c_init_all_positions(__pyx_v_self, ((PyObject*)__pyx_t_2), 0); if (unlikely(__pyx_t_5 == ((short)-1))) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":652
 *         cdef vector[long] current_clocks
 *         cdef vector[long] new_clocks
 *         signals.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         positions.reserve(len(self.c_accounts))
 *         total_balances.reserve(len(self.c_accounts))
 */
  __pyx_t_2 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 652, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_signals.reserve(__pyx_t_3);

  /* "trapeza/strategy/fx_strategy.pyx":653
 *         cdef vector[long] new_clocks
 *         signals.reserve(len(self.c_accounts))
 *         positions.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         total_balances.reserve(len(self.c_accounts))
 *         current_clocks.reserve(len(self.c_accounts))
 */
  __pyx_t_2 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 653, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_positions.reserve(__pyx_t_3);

  /* "trapeza/strategy/fx_strategy.pyx":654
 *         signals.reserve(len(self.c_accounts))
 *         positions.reserve(len(self.c_accounts))
 *         total_balances.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         current_clocks.reserve(len(self.c_accounts))
 *         new_clocks.reserve(len(self.c_accounts))
 */
  __pyx_t_2 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 654, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_total_balances.reserve(__pyx_t_3);

  /* "trapeza/strategy/fx_strategy.pyx":655
 *         positions.reserve(len(self.c_accounts))
 *         total_balances.reserve(len(self.c_accounts))
 *         current_clocks.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         new_clocks.reserve(len(self.c_accounts))
 *         cdef long i = 0
 */
  __pyx_t_2 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 655, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_current_clocks.reserve(__pyx_t_3);

  /* "trapeza/strategy/fx_strategy.pyx":656
 *         total_balances.reserve(len(self.c_accounts))
 *         current_clocks.reserve(len(self.c_accounts))
 *         new_clocks.reserve(len(self.c_accounts))             # <<<<<<<<<<<<<<
 *         cdef long i = 0
 *         cdef dict price_data_point
 */
  __pyx_t_2 = __pyx_v_self->c_accounts;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 656, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_new_clocks.reserve(__pyx_t_3);

  /* "trapeza/strategy/fx_strategy.pyx":657
 *         current_clocks.reserve(len(self.c_accounts))
 *         new_clocks.reserve(len(self.c_accounts))
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef dict price_data_point
 *         cdef dict volume_data_point
 */
  __pyx_v_i = 0;

  /* "trapeza/strategy/fx_strategy.pyx":661
 *         cdef dict volume_data_point
 *         cdef tuple k
 *         try:             # <<<<<<<<<<<<<<
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "trapeza/strategy/fx_strategy.pyx":662
 *         cdef tuple k
 *         try:
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             current_clocks = [acc.clock for acc in self.c_accounts]
 */
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 662, __pyx_L12_error)
        }
        __pyx_t_1 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
        for (;;) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 662, __pyx_L12_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 662, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_acc, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr12__pyx_v_acc, __pyx_n_s_c_clock); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 662, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 662, __pyx_L12_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_acc); __pyx_9genexpr12__pyx_v_acc = 0;
        goto __pyx_L15_exit_scope;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_acc); __pyx_9genexpr12__pyx_v_acc = 0;
        goto __pyx_L4_error;
        __pyx_L15_exit_scope:;
      } /* exit inner scope */
      __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_current_clocks = __pyx_t_10;

      /* "trapeza/strategy/fx_strategy.pyx":661
 *         cdef dict volume_data_point
 *         cdef tuple k
 *         try:             # <<<<<<<<<<<<<<
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":663
 *         try:
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             current_clocks = [acc.clock for acc in self.c_accounts]
 * 
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 663, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_9);

      /* "trapeza/strategy/fx_strategy.pyx":664
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 *             current_clocks = [acc.clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.c_lookback, len_data):
 */
      { /* enter inner scope */
        __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 664, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 664, __pyx_L20_error)
        }
        __pyx_t_13 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0;
        for (;;) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_14); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 664, __pyx_L20_error)
          #else
          __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 664, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_14);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_acc, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr13__pyx_v_acc, __pyx_n_s_clock); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 664, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 664, __pyx_L20_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_acc); __pyx_9genexpr13__pyx_v_acc = 0;
        goto __pyx_L23_exit_scope;
        __pyx_L20_error:;
        __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_acc); __pyx_9genexpr13__pyx_v_acc = 0;
        goto __pyx_L6_except_error;
        __pyx_L23_exit_scope:;
      } /* exit inner scope */
      __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_current_clocks = __pyx_t_10;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "trapeza/strategy/fx_strategy.pyx":661
 *         cdef dict volume_data_point
 *         cdef tuple k
 *         try:             # <<<<<<<<<<<<<<
 *             current_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L9_try_end:;
  }

  /* "trapeza/strategy/fx_strategy.pyx":666
 *             current_clocks = [acc.clock for acc in self.c_accounts]
 * 
 *         for i in range(self.c_lookback, len_data):             # <<<<<<<<<<<<<<
 *             # >>>get current clock to determine if ticking is done within strategy_func
 *             current_clocks.clear()
 */
  __pyx_t_15 = __pyx_v_len_data;
  __pyx_t_16 = __pyx_t_15;
  for (__pyx_t_17 = __pyx_v_self->c_lookback; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
    __pyx_v_i = __pyx_t_17;

    /* "trapeza/strategy/fx_strategy.pyx":668
 *         for i in range(self.c_lookback, len_data):
 *             # >>>get current clock to determine if ticking is done within strategy_func
 *             current_clocks.clear()             # <<<<<<<<<<<<<<
 *             if not self.c_suppress_ticking:
 *                 try:
 */
    __pyx_v_current_clocks.clear();

    /* "trapeza/strategy/fx_strategy.pyx":669
 *             # >>>get current clock to determine if ticking is done within strategy_func
 *             current_clocks.clear()
 *             if not self.c_suppress_ticking:             # <<<<<<<<<<<<<<
 *                 try:
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 */
    __pyx_t_4 = ((!(__pyx_v_self->c_suppress_ticking != 0)) != 0);
    if (__pyx_t_4) {

      /* "trapeza/strategy/fx_strategy.pyx":670
 *             current_clocks.clear()
 *             if not self.c_suppress_ticking:
 *                 try:             # <<<<<<<<<<<<<<
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 *                 except AttributeError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        /*try:*/ {

          /* "trapeza/strategy/fx_strategy.pyx":671
 *             if not self.c_suppress_ticking:
 *                 try:
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *                 except AttributeError:
 *                     current_clocks = [acc.clock for acc in self.c_accounts]
 */
          { /* enter inner scope */
            __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 671, __pyx_L37_error)
            __Pyx_GOTREF(__pyx_t_9);
            if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(0, 671, __pyx_L37_error)
            }
            __pyx_t_1 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
            for (;;) {
              if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 671, __pyx_L37_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L37_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
              __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_acc, __pyx_t_2);
              __pyx_t_2 = 0;
              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr14__pyx_v_acc, __pyx_n_s_c_clock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L37_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 671, __pyx_L37_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_acc); __pyx_9genexpr14__pyx_v_acc = 0;
            goto __pyx_L40_exit_scope;
            __pyx_L37_error:;
            __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_acc); __pyx_9genexpr14__pyx_v_acc = 0;
            goto __pyx_L27_error;
            __pyx_L40_exit_scope:;
          } /* exit inner scope */
          __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L27_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_current_clocks = __pyx_t_10;

          /* "trapeza/strategy/fx_strategy.pyx":670
 *             current_clocks.clear()
 *             if not self.c_suppress_ticking:
 *                 try:             # <<<<<<<<<<<<<<
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 *                 except AttributeError:
 */
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L34_try_end;
        __pyx_L27_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":672
 *                 try:
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 *                 except AttributeError:             # <<<<<<<<<<<<<<
 *                     current_clocks = [acc.clock for acc in self.c_accounts]
 * 
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 672, __pyx_L29_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);

          /* "trapeza/strategy/fx_strategy.pyx":673
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 *                 except AttributeError:
 *                     current_clocks = [acc.clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 * 
 *             # >>>get data for time step i with lookback
 */
          { /* enter inner scope */
            __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 673, __pyx_L45_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
              __PYX_ERR(0, 673, __pyx_L45_error)
            }
            __pyx_t_13 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0;
            for (;;) {
              if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_14); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 673, __pyx_L45_error)
              #else
              __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 673, __pyx_L45_error)
              __Pyx_GOTREF(__pyx_t_14);
              #endif
              __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_acc, __pyx_t_14);
              __pyx_t_14 = 0;
              __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr15__pyx_v_acc, __pyx_n_s_clock); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 673, __pyx_L45_error)
              __Pyx_GOTREF(__pyx_t_14);
              if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 673, __pyx_L45_error)
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            }
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_acc); __pyx_9genexpr15__pyx_v_acc = 0;
            goto __pyx_L48_exit_scope;
            __pyx_L45_error:;
            __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_acc); __pyx_9genexpr15__pyx_v_acc = 0;
            goto __pyx_L29_except_error;
            __pyx_L48_exit_scope:;
          } /* exit inner scope */
          __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L29_except_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_v_current_clocks = __pyx_t_10;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L28_exception_handled;
        }
        goto __pyx_L29_except_error;
        __pyx_L29_except_error:;

        /* "trapeza/strategy/fx_strategy.pyx":670
 *             current_clocks.clear()
 *             if not self.c_suppress_ticking:
 *                 try:             # <<<<<<<<<<<<<<
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 *                 except AttributeError:
 */
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L28_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
        __pyx_L34_try_end:;
      }

      /* "trapeza/strategy/fx_strategy.pyx":669
 *             # >>>get current clock to determine if ticking is done within strategy_func
 *             current_clocks.clear()
 *             if not self.c_suppress_ticking:             # <<<<<<<<<<<<<<
 *                 try:
 *                     current_clocks = [acc._c_clock for acc in self.c_accounts]
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":676
 * 
 *             # >>>get data for time step i with lookback
 *             price_data_point = {k: price_data[k][i - self.c_lookback: i + 1] for k in all_price_pairs}             # <<<<<<<<<<<<<<
 *             if len(volume_data) > 0:
 *                 # noinspection PyUnboundLocalVariable
 */
    { /* enter inner scope */
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L51_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __pyx_v_all_price_pairs; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
      for (;;) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 676, __pyx_L51_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L51_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        if (!(likely(PyTuple_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 676, __pyx_L51_error)
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_k, ((PyObject*)__pyx_t_9));
        __pyx_t_9 = 0;
        if (unlikely(__pyx_v_price_data == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 676, __pyx_L51_error)
        }
        __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_price_data, __pyx_9genexpr16__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L51_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_t_9, (__pyx_v_i - __pyx_v_self->c_lookback), (__pyx_v_i + 1), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 676, __pyx_L51_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_9genexpr16__pyx_v_k, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 676, __pyx_L51_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_k); __pyx_9genexpr16__pyx_v_k = 0;
      goto __pyx_L54_exit_scope;
      __pyx_L51_error:;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_k); __pyx_9genexpr16__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L54_exit_scope:;
    } /* exit inner scope */
    __Pyx_XDECREF_SET(__pyx_v_price_data_point, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":677
 *             # >>>get data for time step i with lookback
 *             price_data_point = {k: price_data[k][i - self.c_lookback: i + 1] for k in all_price_pairs}
 *             if len(volume_data) > 0:             # <<<<<<<<<<<<<<
 *                 # noinspection PyUnboundLocalVariable
 *                 volume_data_point = {k: volume_data[k][i - self.c_lookback: i + 1] for k in all_volume_pairs}
 */
    if (unlikely(__pyx_v_volume_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 677, __pyx_L1_error)
    }
    __pyx_t_3 = PyDict_Size(__pyx_v_volume_data); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 677, __pyx_L1_error)
    __pyx_t_4 = ((__pyx_t_3 > 0) != 0);
    if (__pyx_t_4) {

      /* "trapeza/strategy/fx_strategy.pyx":679
 *             if len(volume_data) > 0:
 *                 # noinspection PyUnboundLocalVariable
 *                 volume_data_point = {k: volume_data[k][i - self.c_lookback: i + 1] for k in all_volume_pairs}             # <<<<<<<<<<<<<<
 * 
 *                 # >>action, go!
 */
      { /* enter inner scope */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L58_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __pyx_v_all_volume_pairs; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
        for (;;) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_12); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 679, __pyx_L58_error)
          #else
          __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 679, __pyx_L58_error)
          __Pyx_GOTREF(__pyx_t_12);
          #endif
          if (!(likely(PyTuple_CheckExact(__pyx_t_12))||((__pyx_t_12) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_12)->tp_name), 0))) __PYX_ERR(0, 679, __pyx_L58_error)
          __Pyx_XDECREF_SET(__pyx_9genexpr17__pyx_v_k, ((PyObject*)__pyx_t_12));
          __pyx_t_12 = 0;
          if (unlikely(__pyx_v_volume_data == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 679, __pyx_L58_error)
          }
          __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_volume_data, __pyx_9genexpr17__pyx_v_k); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 679, __pyx_L58_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_t_12, (__pyx_v_i - __pyx_v_self->c_lookback), (__pyx_v_i + 1), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 679, __pyx_L58_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_9genexpr17__pyx_v_k, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 679, __pyx_L58_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_k); __pyx_9genexpr17__pyx_v_k = 0;
        goto __pyx_L61_exit_scope;
        __pyx_L58_error:;
        __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_k); __pyx_9genexpr17__pyx_v_k = 0;
        goto __pyx_L1_error;
        __pyx_L61_exit_scope:;
      } /* exit inner scope */
      __Pyx_XDECREF_SET(__pyx_v_volume_data_point, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":682
 * 
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), volume_data_point,             # <<<<<<<<<<<<<<
 *                                    self, **self.c_strategy_kwargs)
 *             else:
 */
      __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_v_reference_currency, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "trapeza/strategy/fx_strategy.pyx":683
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), volume_data_point,
 *                                    self, **self.c_strategy_kwargs)             # <<<<<<<<<<<<<<
 *             else:
 *                 volume_data_point = {}
 */
      __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_self->c_accounts);
      __Pyx_GIVEREF(__pyx_v_self->c_accounts);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->c_accounts);
      __Pyx_INCREF(__pyx_v_price_data_point);
      __Pyx_GIVEREF(__pyx_v_price_data_point);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_price_data_point);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
      __Pyx_INCREF(__pyx_v_volume_data_point);
      __Pyx_GIVEREF(__pyx_v_volume_data_point);
      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_volume_data_point);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self));
      __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":682
 * 
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), volume_data_point,             # <<<<<<<<<<<<<<
 *                                    self, **self.c_strategy_kwargs)
 *             else:
 */
      if (unlikely(__pyx_v_self->c_strategy_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 683, __pyx_L1_error)
      }
      __pyx_t_2 = PyDict_Copy(__pyx_v_self->c_strategy_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_self->c_strategy_func, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":677
 *             # >>>get data for time step i with lookback
 *             price_data_point = {k: price_data[k][i - self.c_lookback: i + 1] for k in all_price_pairs}
 *             if len(volume_data) > 0:             # <<<<<<<<<<<<<<
 *                 # noinspection PyUnboundLocalVariable
 *                 volume_data_point = {k: volume_data[k][i - self.c_lookback: i + 1] for k in all_volume_pairs}
 */
      goto __pyx_L55;
    }

    /* "trapeza/strategy/fx_strategy.pyx":685
 *                                    self, **self.c_strategy_kwargs)
 *             else:
 *                 volume_data_point = {}             # <<<<<<<<<<<<<<
 * 
 *                 # >>action, go!
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 685, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_volume_data_point, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":688
 * 
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), None, self,             # <<<<<<<<<<<<<<
 *                                      **self.c_strategy_kwargs)
 * 
 */
      __pyx_t_9 = __Pyx_decode_cpp_string(__pyx_v_reference_currency, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_self->c_accounts);
      __Pyx_GIVEREF(__pyx_v_self->c_accounts);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->c_accounts);
      __Pyx_INCREF(__pyx_v_price_data_point);
      __Pyx_GIVEREF(__pyx_v_price_data_point);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_price_data_point);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_self));
      __pyx_t_9 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":689
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), None, self,
 *                                      **self.c_strategy_kwargs)             # <<<<<<<<<<<<<<
 * 
 *             # >>>tick, if needed
 */
      if (unlikely(__pyx_v_self->c_strategy_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 689, __pyx_L1_error)
      }
      __pyx_t_9 = PyDict_Copy(__pyx_v_self->c_strategy_kwargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "trapeza/strategy/fx_strategy.pyx":688
 * 
 *                 # >>action, go!
 *                 self.c_strategy_func(self.c_accounts, price_data_point, reference_currency.decode(), None, self,             # <<<<<<<<<<<<<<
 *                                      **self.c_strategy_kwargs)
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->c_strategy_func, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L55:;

    /* "trapeza/strategy/fx_strategy.pyx":692
 * 
 *             # >>>tick, if needed
 *             new_clocks.clear()             # <<<<<<<<<<<<<<
 *             try:
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 */
    __pyx_v_new_clocks.clear();

    /* "trapeza/strategy/fx_strategy.pyx":693
 *             # >>>tick, if needed
 *             new_clocks.clear()
 *             try:             # <<<<<<<<<<<<<<
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 *             except AttributeError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "trapeza/strategy/fx_strategy.pyx":694
 *             new_clocks.clear()
 *             try:
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 new_clocks = [acc.clock for acc in self.c_accounts]
 */
        { /* enter inner scope */
          __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L72_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 694, __pyx_L72_error)
          }
          __pyx_t_9 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0;
          for (;;) {
            if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 694, __pyx_L72_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L72_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
            __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_acc, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr18__pyx_v_acc, __pyx_n_s_c_clock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L72_error)
            __Pyx_GOTREF(__pyx_t_2);
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 694, __pyx_L72_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_acc); __pyx_9genexpr18__pyx_v_acc = 0;
          goto __pyx_L75_exit_scope;
          __pyx_L72_error:;
          __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_acc); __pyx_9genexpr18__pyx_v_acc = 0;
          goto __pyx_L62_error;
          __pyx_L75_exit_scope:;
        } /* exit inner scope */
        __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L62_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_new_clocks = __pyx_t_10;

        /* "trapeza/strategy/fx_strategy.pyx":693
 *             # >>>tick, if needed
 *             new_clocks.clear()
 *             try:             # <<<<<<<<<<<<<<
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 *             except AttributeError:
 */
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L69_try_end;
      __pyx_L62_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":695
 *             try:
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 new_clocks = [acc.clock for acc in self.c_accounts]
 *             # lazy evaluation
 */
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_11) {
        __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(0, 695, __pyx_L64_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_2);

        /* "trapeza/strategy/fx_strategy.pyx":696
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 *             except AttributeError:
 *                 new_clocks = [acc.clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *             # lazy evaluation
 *             if not self.c_suppress_ticking and current_clocks == new_clocks:
 */
        { /* enter inner scope */
          __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 696, __pyx_L80_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 696, __pyx_L80_error)
          }
          __pyx_t_13 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0;
          for (;;) {
            if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_14); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 696, __pyx_L80_error)
            #else
            __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 696, __pyx_L80_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
            __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_acc, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr19__pyx_v_acc, __pyx_n_s_clock); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 696, __pyx_L80_error)
            __Pyx_GOTREF(__pyx_t_14);
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 696, __pyx_L80_error)
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_acc); __pyx_9genexpr19__pyx_v_acc = 0;
          goto __pyx_L83_exit_scope;
          __pyx_L80_error:;
          __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_acc); __pyx_9genexpr19__pyx_v_acc = 0;
          goto __pyx_L64_except_error;
          __pyx_L83_exit_scope:;
        } /* exit inner scope */
        __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L64_except_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_v_new_clocks = __pyx_t_10;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L63_exception_handled;
      }
      goto __pyx_L64_except_error;
      __pyx_L64_except_error:;

      /* "trapeza/strategy/fx_strategy.pyx":693
 *             # >>>tick, if needed
 *             new_clocks.clear()
 *             try:             # <<<<<<<<<<<<<<
 *                 new_clocks = [acc._c_clock for acc in self.c_accounts]
 *             except AttributeError:
 */
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L63_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L69_try_end:;
    }

    /* "trapeza/strategy/fx_strategy.pyx":698
 *                 new_clocks = [acc.clock for acc in self.c_accounts]
 *             # lazy evaluation
 *             if not self.c_suppress_ticking and current_clocks == new_clocks:             # <<<<<<<<<<<<<<
 *             # if not self.c_suppress_ticking and set_previous == set_current:
 *                 if len(self.c_tick_kwargs) > 0:
 */
    __pyx_t_18 = ((!(__pyx_v_self->c_suppress_ticking != 0)) != 0);
    if (__pyx_t_18) {
    } else {
      __pyx_t_4 = __pyx_t_18;
      goto __pyx_L85_bool_binop_done;
    }
    __pyx_t_18 = ((__pyx_v_current_clocks == __pyx_v_new_clocks) != 0);
    __pyx_t_4 = __pyx_t_18;
    __pyx_L85_bool_binop_done:;
    if (__pyx_t_4) {

      /* "trapeza/strategy/fx_strategy.pyx":700
 *             if not self.c_suppress_ticking and current_clocks == new_clocks:
 *             # if not self.c_suppress_ticking and set_previous == set_current:
 *                 if len(self.c_tick_kwargs) > 0:             # <<<<<<<<<<<<<<
 *                     self.c_tick_method(self, price_data_point, **self.c_tick_kwargs)
 *                 else:
 */
      __pyx_t_2 = __pyx_v_self->c_tick_kwargs;
      __Pyx_INCREF(__pyx_t_2);
      if (unlikely(__pyx_t_2 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 700, __pyx_L1_error)
      }
      __pyx_t_3 = PyDict_Size(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = ((__pyx_t_3 > 0) != 0);
      if (__pyx_t_4) {

        /* "trapeza/strategy/fx_strategy.pyx":701
 *             # if not self.c_suppress_ticking and set_previous == set_current:
 *                 if len(self.c_tick_kwargs) > 0:
 *                     self.c_tick_method(self, price_data_point, **self.c_tick_kwargs)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.c_tick_method(self, price_data_point)
 */
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
        __Pyx_INCREF(__pyx_v_price_data_point);
        __Pyx_GIVEREF(__pyx_v_price_data_point);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_price_data_point);
        if (unlikely(__pyx_v_self->c_tick_kwargs == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 701, __pyx_L1_error)
        }
        __pyx_t_9 = PyDict_Copy(__pyx_v_self->c_tick_kwargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->c_tick_method, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":700
 *             if not self.c_suppress_ticking and current_clocks == new_clocks:
 *             # if not self.c_suppress_ticking and set_previous == set_current:
 *                 if len(self.c_tick_kwargs) > 0:             # <<<<<<<<<<<<<<
 *                     self.c_tick_method(self, price_data_point, **self.c_tick_kwargs)
 *                 else:
 */
        goto __pyx_L87;
      }

      /* "trapeza/strategy/fx_strategy.pyx":703
 *                     self.c_tick_method(self, price_data_point, **self.c_tick_kwargs)
 *                 else:
 *                     self.c_tick_method(self, price_data_point)             # <<<<<<<<<<<<<<
 * 
 *             # >>>evaluate results and simultaneously append to final internally stored results
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_v_self->c_tick_method);
        __pyx_t_9 = __pyx_v_self->c_tick_method; __pyx_t_2 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
            __pyx_t_11 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_price_data_point};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_price_data_point};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 703, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_self));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, ((PyObject *)__pyx_v_self));
          __Pyx_INCREF(__pyx_v_price_data_point);
          __Pyx_GIVEREF(__pyx_v_price_data_point);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_price_data_point);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L87:;

      /* "trapeza/strategy/fx_strategy.pyx":698
 *                 new_clocks = [acc.clock for acc in self.c_accounts]
 *             # lazy evaluation
 *             if not self.c_suppress_ticking and current_clocks == new_clocks:             # <<<<<<<<<<<<<<
 *             # if not self.c_suppress_ticking and set_previous == set_current:
 *                 if len(self.c_tick_kwargs) > 0:
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":706
 * 
 *             # >>>evaluate results and simultaneously append to final internally stored results
 *             self.c_evaluate(price_data_point, reference_currency, True, &signals, &positions, &total_balances)             # <<<<<<<<<<<<<<
 * 
 *         # >>>check if ticked
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->c_evaluate(__pyx_v_self, __pyx_v_price_data_point, __pyx_v_reference_currency, 1, (&__pyx_v_signals), (&__pyx_v_positions), (&__pyx_v_total_balances)); if (unlikely(__pyx_t_5 == ((short)-1))) __PYX_ERR(0, 706, __pyx_L1_error)
  }

  /* "trapeza/strategy/fx_strategy.pyx":709
 * 
 *         # >>>check if ticked
 *         new_clocks.clear()             # <<<<<<<<<<<<<<
 *         try:
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 */
  __pyx_v_new_clocks.clear();

  /* "trapeza/strategy/fx_strategy.pyx":710
 *         # >>>check if ticked
 *         new_clocks.clear()
 *         try:             # <<<<<<<<<<<<<<
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "trapeza/strategy/fx_strategy.pyx":711
 *         new_clocks.clear()
 *         try:
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             new_clocks = [acc.clock for acc in self.c_accounts]
 */
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L96_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 711, __pyx_L96_error)
        }
        __pyx_t_9 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0;
        for (;;) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_12 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_12); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 711, __pyx_L96_error)
          #else
          __pyx_t_12 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 711, __pyx_L96_error)
          __Pyx_GOTREF(__pyx_t_12);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_acc, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr20__pyx_v_acc, __pyx_n_s_c_clock); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 711, __pyx_L96_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 711, __pyx_L96_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_acc); __pyx_9genexpr20__pyx_v_acc = 0;
        goto __pyx_L99_exit_scope;
        __pyx_L96_error:;
        __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_acc); __pyx_9genexpr20__pyx_v_acc = 0;
        goto __pyx_L88_error;
        __pyx_L99_exit_scope:;
      } /* exit inner scope */
      __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L88_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_new_clocks = __pyx_t_10;

      /* "trapeza/strategy/fx_strategy.pyx":710
 *         # >>>check if ticked
 *         new_clocks.clear()
 *         try:             # <<<<<<<<<<<<<<
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L93_try_end;
    __pyx_L88_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":712
 *         try:
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             new_clocks = [acc.clock for acc in self.c_accounts]
 *         if not self.c_suppress_ticking and current_clocks == new_clocks:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_9, &__pyx_t_12) < 0) __PYX_ERR(0, 712, __pyx_L90_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_12);

      /* "trapeza/strategy/fx_strategy.pyx":713
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 *             new_clocks = [acc.clock for acc in self.c_accounts]             # <<<<<<<<<<<<<<
 *         if not self.c_suppress_ticking and current_clocks == new_clocks:
 *             raise tpz_exception.OperatingError('Account clocks have not been ticked although '
 */
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L104_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(__pyx_v_self->c_accounts == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 713, __pyx_L104_error)
        }
        __pyx_t_13 = __pyx_v_self->c_accounts; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0;
        for (;;) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_14); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 713, __pyx_L104_error)
          #else
          __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 713, __pyx_L104_error)
          __Pyx_GOTREF(__pyx_t_14);
          #endif
          __Pyx_XDECREF_SET(__pyx_9genexpr21__pyx_v_acc, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr21__pyx_v_acc, __pyx_n_s_clock); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 713, __pyx_L104_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 713, __pyx_L104_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_acc); __pyx_9genexpr21__pyx_v_acc = 0;
        goto __pyx_L107_exit_scope;
        __pyx_L104_error:;
        __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_acc); __pyx_9genexpr21__pyx_v_acc = 0;
        goto __pyx_L90_except_error;
        __pyx_L107_exit_scope:;
      } /* exit inner scope */
      __pyx_t_10 = __pyx_convert_vector_from_py_long(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L90_except_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_new_clocks = __pyx_t_10;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L89_exception_handled;
    }
    goto __pyx_L90_except_error;
    __pyx_L90_except_error:;

    /* "trapeza/strategy/fx_strategy.pyx":710
 *         # >>>check if ticked
 *         new_clocks.clear()
 *         try:             # <<<<<<<<<<<<<<
 *             new_clocks = [acc._c_clock for acc in self.c_accounts]
 *         except AttributeError:
 */
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L89_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    __pyx_L93_try_end:;
  }

  /* "trapeza/strategy/fx_strategy.pyx":714
 *         except AttributeError:
 *             new_clocks = [acc.clock for acc in self.c_accounts]
 *         if not self.c_suppress_ticking and current_clocks == new_clocks:             # <<<<<<<<<<<<<<
 *             raise tpz_exception.OperatingError('Account clocks have not been ticked although '
 *                                                'param:suppress_ticking=False specifies ticking behavior.')
 */
  __pyx_t_18 = ((!(__pyx_v_self->c_suppress_ticking != 0)) != 0);
  if (__pyx_t_18) {
  } else {
    __pyx_t_4 = __pyx_t_18;
    goto __pyx_L109_bool_binop_done;
  }
  __pyx_t_18 = ((__pyx_v_current_clocks == __pyx_v_new_clocks) != 0);
  __pyx_t_4 = __pyx_t_18;
  __pyx_L109_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "trapeza/strategy/fx_strategy.pyx":715
 *             new_clocks = [acc.clock for acc in self.c_accounts]
 *         if not self.c_suppress_ticking and current_clocks == new_clocks:
 *             raise tpz_exception.OperatingError('Account clocks have not been ticked although '             # <<<<<<<<<<<<<<
 *                                                'param:suppress_ticking=False specifies ticking behavior.')
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_tpz_exception); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_OperatingError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_12 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_kp_u_Account_clocks_have_not_been_tic) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_Account_clocks_have_not_been_tic);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 715, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":714
 *         except AttributeError:
 *             new_clocks = [acc.clock for acc in self.c_accounts]
 *         if not self.c_suppress_ticking and current_clocks == new_clocks:             # <<<<<<<<<<<<<<
 *             raise tpz_exception.OperatingError('Account clocks have not been ticked although '
 *                                                'param:suppress_ticking=False specifies ticking behavior.')
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":718
 *                                                'param:suppress_ticking=False specifies ticking behavior.')
 * 
 *         ret_signals[0] = self.c_signals             # <<<<<<<<<<<<<<
 *         ret_positions[0] = self.c_positions
 *         ret_merged_positions[0] = self.c_merged_positions
 */
  __pyx_t_19 = __pyx_v_self->c_signals;
  (__pyx_v_ret_signals[0]) = __pyx_t_19;

  /* "trapeza/strategy/fx_strategy.pyx":719
 * 
 *         ret_signals[0] = self.c_signals
 *         ret_positions[0] = self.c_positions             # <<<<<<<<<<<<<<
 *         ret_merged_positions[0] = self.c_merged_positions
 *         ret_total_balances[0] = self.c_total_balances
 */
  __pyx_t_20 = __pyx_v_self->c_positions;
  (__pyx_v_ret_positions[0]) = __pyx_t_20;

  /* "trapeza/strategy/fx_strategy.pyx":720
 *         ret_signals[0] = self.c_signals
 *         ret_positions[0] = self.c_positions
 *         ret_merged_positions[0] = self.c_merged_positions             # <<<<<<<<<<<<<<
 *         ret_total_balances[0] = self.c_total_balances
 *         ret_merged_total_balances[0] = self.c_merged_total_balances
 */
  __pyx_t_21 = __pyx_v_self->c_merged_positions;
  (__pyx_v_ret_merged_positions[0]) = __pyx_t_21;

  /* "trapeza/strategy/fx_strategy.pyx":721
 *         ret_positions[0] = self.c_positions
 *         ret_merged_positions[0] = self.c_merged_positions
 *         ret_total_balances[0] = self.c_total_balances             # <<<<<<<<<<<<<<
 *         ret_merged_total_balances[0] = self.c_merged_total_balances
 *         return 1
 */
  __pyx_t_22 = __pyx_v_self->c_total_balances;
  (__pyx_v_ret_total_balances[0]) = __pyx_t_22;

  /* "trapeza/strategy/fx_strategy.pyx":722
 *         ret_merged_positions[0] = self.c_merged_positions
 *         ret_total_balances[0] = self.c_total_balances
 *         ret_merged_total_balances[0] = self.c_merged_total_balances             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  __pyx_t_23 = __pyx_v_self->c_merged_total_balances;
  (__pyx_v_ret_merged_total_balances[0]) = __pyx_t_23;

  /* "trapeza/strategy/fx_strategy.pyx":723
 *         ret_total_balances[0] = self.c_total_balances
 *         ret_merged_total_balances[0] = self.c_merged_total_balances
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     @cython.boundscheck(False)
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":607
 * 
 *     @cython.wraparound(False)
 *     cdef short c_run(self, dict price_data, string reference_currency, dict volume_data, long len_data,             # <<<<<<<<<<<<<<
 *                      vector[vector[vector[string]]] *ret_signals,
 *                      unordered_map[string, vector[vector[double]]] *ret_positions,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_all_price_pairs);
  __Pyx_XDECREF(__pyx_v_all_volume_pairs);
  __Pyx_XDECREF(__pyx_v_price_data_point);
  __Pyx_XDECREF(__pyx_v_volume_data_point);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_acc);
  __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_acc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":727
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef list c_wrap_run(self, dict price_data, string reference_currency, dict volume_data, long len_data):             # <<<<<<<<<<<<<<
 *         """
 *         Serves as wrapper between self.c_run and FXStrategy.run.
 */

static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_39c_wrap_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data, int __pyx_skip_dispatch) {
  std::vector<std::vector<std::vector<std::string> > >  __pyx_v_signals;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_v_positions;
  std::unordered_map<std::string,std::vector<double> >  __pyx_v_merged_positions;
  std::vector<std::vector<double> >  __pyx_v_total_balances;
  std::vector<double>  __pyx_v_merged_total_balances;
  PyObject *__pyx_v_ret_signals = 0;
  PyObject *__pyx_v_ret_positions = 0;
  PyObject *__pyx_v_ret_merged_positions = 0;
  PyObject *__pyx_v_ret_total_balances = 0;
  PyObject *__pyx_v_ret_merged_total_balances = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  short __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_wrap_run", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_c_wrap_run); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_39c_wrap_run)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_reference_currency); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_len_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_price_data, __pyx_t_3, __pyx_v_volume_data, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_price_data, __pyx_t_3, __pyx_v_volume_data, __pyx_t_4};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 727, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_v_price_data);
          __Pyx_GIVEREF(__pyx_v_price_data);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_price_data);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
          __Pyx_INCREF(__pyx_v_volume_data);
          __Pyx_GIVEREF(__pyx_v_volume_data);
          PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_volume_data);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 727, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "trapeza/strategy/fx_strategy.pyx":755
 *         cdef vector[double] merged_total_balances
 * 
 *         self.c_run(price_data, reference_currency, volume_data, len_data,             # <<<<<<<<<<<<<<
 *                    &signals, &positions, &merged_positions, &total_balances, &merged_total_balances)
 * 
 */
  __pyx_t_9 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->c_run(__pyx_v_self, __pyx_v_price_data, __pyx_v_reference_currency, __pyx_v_volume_data, __pyx_v_len_data, (&__pyx_v_signals), (&__pyx_v_positions), (&__pyx_v_merged_positions), (&__pyx_v_total_balances), (&__pyx_v_merged_total_balances)); if (unlikely(__pyx_t_9 == ((short)-1))) __PYX_ERR(0, 755, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":759
 * 
 *         # cdef vector[vector[vector[string]]] signals
 *         cdef list ret_signals = self.parse_signals(signals)             # <<<<<<<<<<<<<<
 * 
 *         # cdef unordered_map[string, vector[vector[double]]] positions
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_signals(__pyx_v_self, __pyx_v_signals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_signals = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":762
 * 
 *         # cdef unordered_map[string, vector[vector[double]]] positions
 *         cdef dict ret_positions = self.parse_positions(positions)             # <<<<<<<<<<<<<<
 * 
 *         # cdef unordered_map[string, vector[double]] merged_positions
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_positions(__pyx_v_self, __pyx_v_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_positions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":765
 * 
 *         # cdef unordered_map[string, vector[double]] merged_positions
 *         cdef dict ret_merged_positions = self.parse_merged_positions(merged_positions)             # <<<<<<<<<<<<<<
 * 
 *         # cdef vector[vector[double]] total_balances
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_merged_positions(__pyx_v_self, __pyx_v_merged_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_merged_positions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":768
 * 
 *         # cdef vector[vector[double]] total_balances
 *         cdef list ret_total_balances = self.parse_total_balances(total_balances)             # <<<<<<<<<<<<<<
 * 
 *         # cdef vector[double] merged_total_balances
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_total_balances(__pyx_v_self, __pyx_v_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_total_balances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":771
 * 
 *         # cdef vector[double] merged_total_balances
 *         cdef list ret_merged_total_balances = self.parse_merged_total_balances(merged_total_balances)             # <<<<<<<<<<<<<<
 * 
 *         return [reference_currency.decode(), ret_signals, ret_positions, ret_merged_positions,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self->__pyx_vtab)->parse_merged_total_balances(__pyx_v_self, __pyx_v_merged_total_balances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret_merged_total_balances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":773
 *         cdef list ret_merged_total_balances = self.parse_merged_total_balances(merged_total_balances)
 * 
 *         return [reference_currency.decode(), ret_signals, ret_positions, ret_merged_positions,             # <<<<<<<<<<<<<<
 *                 ret_total_balances, ret_merged_total_balances]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_reference_currency, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "trapeza/strategy/fx_strategy.pyx":774
 * 
 *         return [reference_currency.decode(), ret_signals, ret_positions, ret_merged_positions,
 *                 ret_total_balances, ret_merged_total_balances]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_ret_signals);
  __Pyx_GIVEREF(__pyx_v_ret_signals);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_ret_signals);
  __Pyx_INCREF(__pyx_v_ret_positions);
  __Pyx_GIVEREF(__pyx_v_ret_positions);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_v_ret_positions);
  __Pyx_INCREF(__pyx_v_ret_merged_positions);
  __Pyx_GIVEREF(__pyx_v_ret_merged_positions);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_v_ret_merged_positions);
  __Pyx_INCREF(__pyx_v_ret_total_balances);
  __Pyx_GIVEREF(__pyx_v_ret_total_balances);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_v_ret_total_balances);
  __Pyx_INCREF(__pyx_v_ret_merged_total_balances);
  __Pyx_GIVEREF(__pyx_v_ret_merged_total_balances);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_v_ret_merged_total_balances);
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":727
 *     @cython.boundscheck(False)
 *     @cython.wraparound(False)
 *     cpdef list c_wrap_run(self, dict price_data, string reference_currency, dict volume_data, long len_data):             # <<<<<<<<<<<<<<
 *         """
 *         Serves as wrapper between self.c_run and FXStrategy.run.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret_signals);
  __Pyx_XDECREF(__pyx_v_ret_positions);
  __Pyx_XDECREF(__pyx_v_ret_merged_positions);
  __Pyx_XDECREF(__pyx_v_ret_total_balances);
  __Pyx_XDECREF(__pyx_v_ret_merged_total_balances);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_39c_wrap_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_38c_wrap_run[] = "\n        Serves as wrapper between self.c_run and FXStrategy.run.\n        See docstrings of self.c_run and FXStrategy.run for further details.\n        :param price_data: dict,\n                           keys: tuple of py_strings (base, quote)\n                           value: list of floats representing exchange_rates at every time_step (including \n                                  historic lookback portion), all lists must have same length\n                           see FXStrategy.run for further details \n        :param reference_currency: std:string\n        :param volume_data: dict, same structure as param:price_data, but with volumes instead of exchange_rates,\n                            see FXStrategy.run for further details\n        :param len_data: long, length of lists contained in price_data (including historic lookback portion)\n        :return: list[reference_currency, ret_signals, ret_positions, ret_merged_positions,\n                      ret_total_balances, ret_merged_total_balances]\n                          reference_currency: py_str\n                          ret_signals: list of lists of lists, see FXStrategy.signals\n                          ret_positions: dict, see FXStrategy.positions\n                          ret_merged_positions: dict, see FXStrategy.merged_positions\n                          ret_total_balances: list of lists, see FXStrategy.total_balances\n                          ret_merged_total_balances: list, see FXStrategy.merged_total_balances\n        ";
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_39c_wrap_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_price_data = 0;
  std::string __pyx_v_reference_currency;
  PyObject *__pyx_v_volume_data = 0;
  long __pyx_v_len_data;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_wrap_run (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_price_data,&__pyx_n_s_reference_currency,&__pyx_n_s_volume_data,&__pyx_n_s_len_data,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_price_data)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reference_currency)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_wrap_run", 1, 4, 4, 1); __PYX_ERR(0, 727, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_volume_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_wrap_run", 1, 4, 4, 2); __PYX_ERR(0, 727, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_len_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("c_wrap_run", 1, 4, 4, 3); __PYX_ERR(0, 727, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "c_wrap_run") < 0)) __PYX_ERR(0, 727, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_price_data = ((PyObject*)values[0]);
    __pyx_v_reference_currency = __pyx_convert_string_from_py_std__in_string(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 727, __pyx_L3_error)
    __pyx_v_volume_data = ((PyObject*)values[2]);
    __pyx_v_len_data = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_len_data == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 727, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("c_wrap_run", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 727, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_price_data), (&PyDict_Type), 1, "price_data", 1))) __PYX_ERR(0, 727, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_volume_data), (&PyDict_Type), 1, "volume_data", 1))) __PYX_ERR(0, 727, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_38c_wrap_run(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), __pyx_v_price_data, __pyx_v_reference_currency, __pyx_v_volume_data, __pyx_v_len_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_38c_wrap_run(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_price_data, std::string __pyx_v_reference_currency, PyObject *__pyx_v_volume_data, long __pyx_v_len_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("c_wrap_run", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_run(__pyx_v_self, __pyx_v_price_data, __pyx_v_reference_currency, __pyx_v_volume_data, __pyx_v_len_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_wrap_run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":20
 *     cdef unordered_map[long,vector[string]] _c_signals_at_step_t
 * 
 *     cdef public string c_name             # <<<<<<<<<<<<<<
 *     cdef readonly bool_t _c_ignore_type_checking
 *     cdef public list c_accounts
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->c_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  std::string __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error)
  __pyx_v_self->c_name = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":21
 * 
 *     cdef public string c_name
 *     cdef readonly bool_t _c_ignore_type_checking             # <<<<<<<<<<<<<<
 *     cdef public list c_accounts
 *     cdef public long c_lookback
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_ignore_type_checking.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":22
 *     cdef public string c_name
 *     cdef readonly bool_t _c_ignore_type_checking
 *     cdef public list c_accounts             # <<<<<<<<<<<<<<
 *     cdef public long c_lookback
 *     cdef public bool_t c_suppress_ticking
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->c_accounts);
  __pyx_r = __pyx_v_self->c_accounts;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 22, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->c_accounts);
  __Pyx_DECREF(__pyx_v_self->c_accounts);
  __pyx_v_self->c_accounts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_accounts.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->c_accounts);
  __Pyx_DECREF(__pyx_v_self->c_accounts);
  __pyx_v_self->c_accounts = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":23
 *     cdef readonly bool_t _c_ignore_type_checking
 *     cdef public list c_accounts
 *     cdef public long c_lookback             # <<<<<<<<<<<<<<
 *     cdef public bool_t c_suppress_ticking
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->c_lookback); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_lookback.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 23, __pyx_L1_error)
  __pyx_v_self->c_lookback = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_lookback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":24
 *     cdef public list c_accounts
 *     cdef public long c_lookback
 *     cdef public bool_t c_suppress_ticking             # <<<<<<<<<<<<<<
 * 
 *     cdef public dict c_strategy_kwargs  # py_strings only
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c_suppress_ticking); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_suppress_ticking.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 24, __pyx_L1_error)
  __pyx_v_self->c_suppress_ticking = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_suppress_ticking.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":26
 *     cdef public bool_t c_suppress_ticking
 * 
 *     cdef public dict c_strategy_kwargs  # py_strings only             # <<<<<<<<<<<<<<
 *     cdef public dict c_tick_kwargs  # py_strings_only
 *     cdef public object c_strategy_func
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->c_strategy_kwargs);
  __pyx_r = __pyx_v_self->c_strategy_kwargs;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_strategy_kwargs);
  __pyx_v_self->c_strategy_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_strategy_kwargs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_strategy_kwargs);
  __pyx_v_self->c_strategy_kwargs = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":27
 * 
 *     cdef public dict c_strategy_kwargs  # py_strings only
 *     cdef public dict c_tick_kwargs  # py_strings_only             # <<<<<<<<<<<<<<
 *     cdef public object c_strategy_func
 *     cdef public object c_tick_method
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->c_tick_kwargs);
  __pyx_r = __pyx_v_self->c_tick_kwargs;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 27, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->c_tick_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_tick_kwargs);
  __pyx_v_self->c_tick_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.c_tick_kwargs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->c_tick_kwargs);
  __Pyx_DECREF(__pyx_v_self->c_tick_kwargs);
  __pyx_v_self->c_tick_kwargs = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":28
 *     cdef public dict c_strategy_kwargs  # py_strings only
 *     cdef public dict c_tick_kwargs  # py_strings_only
 *     cdef public object c_strategy_func             # <<<<<<<<<<<<<<
 *     cdef public object c_tick_method
 *     cdef public list _c_init_accs_depots    # list of dicts of py_objects
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->c_strategy_func);
  __pyx_r = __pyx_v_self->c_strategy_func;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_func);
  __Pyx_DECREF(__pyx_v_self->c_strategy_func);
  __pyx_v_self->c_strategy_func = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->c_strategy_func);
  __Pyx_DECREF(__pyx_v_self->c_strategy_func);
  __pyx_v_self->c_strategy_func = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":29
 *     cdef public dict c_tick_kwargs  # py_strings_only
 *     cdef public object c_strategy_func
 *     cdef public object c_tick_method             # <<<<<<<<<<<<<<
 *     cdef public list _c_init_accs_depots    # list of dicts of py_objects
 *     cdef public list _c_accs_clocks         # list of py_ints
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->c_tick_method);
  __pyx_r = __pyx_v_self->c_tick_method;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->c_tick_method);
  __Pyx_DECREF(__pyx_v_self->c_tick_method);
  __pyx_v_self->c_tick_method = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->c_tick_method);
  __Pyx_DECREF(__pyx_v_self->c_tick_method);
  __pyx_v_self->c_tick_method = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":30
 *     cdef public object c_strategy_func
 *     cdef public object c_tick_method
 *     cdef public list _c_init_accs_depots    # list of dicts of py_objects             # <<<<<<<<<<<<<<
 *     cdef public list _c_accs_clocks         # list of py_ints
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_c_init_accs_depots);
  __pyx_r = __pyx_v_self->_c_init_accs_depots;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 30, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_c_init_accs_depots);
  __Pyx_DECREF(__pyx_v_self->_c_init_accs_depots);
  __pyx_v_self->_c_init_accs_depots = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_init_accs_depots.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_c_init_accs_depots);
  __Pyx_DECREF(__pyx_v_self->_c_init_accs_depots);
  __pyx_v_self->_c_init_accs_depots = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pxd":31
 *     cdef public object c_tick_method
 *     cdef public list _c_init_accs_depots    # list of dicts of py_objects
 *     cdef public list _c_accs_clocks         # list of py_ints             # <<<<<<<<<<<<<<
 * 
 *     cpdef short c_init(self, string name, list accounts, object strategy_func, long lookback, object tick_func,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks___get__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks___get__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_c_accs_clocks);
  __pyx_r = __pyx_v_self->_c_accs_clocks;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_2__set__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_2__set__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 31, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_c_accs_clocks);
  __Pyx_DECREF(__pyx_v_self->_c_accs_clocks);
  __pyx_v_self->_c_accs_clocks = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy._c_accs_clocks.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_4__del__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_4__del__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_c_accs_clocks);
  __Pyx_DECREF(__pyx_v_self->_c_accs_clocks);
  __pyx_v_self->_c_accs_clocks = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_41__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_41__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_40__reduce_cython__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_40__reduce_cython__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._c_accs_clocks, self._c_ignore_type_checking, self._c_init_accs_depots, self._c_signals_at_step_t, self.c_accounts, self.c_lookback, self.c_merged_positions, self.c_merged_total_balances, self.c_name, self.c_positions, self.c_signals, self.c_strategy_func, self.c_strategy_kwargs, self.c_suppress_ticking, self.c_tick_kwargs, self.c_tick_method, self.c_total_balances)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(__pyx_v_self->_c_signals_at_step_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_self->c_lookback); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(__pyx_v_self->c_merged_positions); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_convert_vector_to_py_double(__pyx_v_self->c_merged_total_balances); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->c_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(__pyx_v_self->c_positions); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(__pyx_v_self->c_signals); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->c_suppress_ticking); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(__pyx_v_self->c_total_balances); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(17); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_v_self->_c_accs_clocks);
  __Pyx_GIVEREF(__pyx_v_self->_c_accs_clocks);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_self->_c_accs_clocks);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_c_init_accs_depots);
  __Pyx_GIVEREF(__pyx_v_self->_c_init_accs_depots);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_self->_c_init_accs_depots);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->c_accounts);
  __Pyx_GIVEREF(__pyx_v_self->c_accounts);
  PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_v_self->c_accounts);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_11, 8, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_11, 9, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_11, 10, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->c_strategy_func);
  __Pyx_GIVEREF(__pyx_v_self->c_strategy_func);
  PyTuple_SET_ITEM(__pyx_t_11, 11, __pyx_v_self->c_strategy_func);
  __Pyx_INCREF(__pyx_v_self->c_strategy_kwargs);
  __Pyx_GIVEREF(__pyx_v_self->c_strategy_kwargs);
  PyTuple_SET_ITEM(__pyx_t_11, 12, __pyx_v_self->c_strategy_kwargs);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_11, 13, __pyx_t_9);
  __Pyx_INCREF(__pyx_v_self->c_tick_kwargs);
  __Pyx_GIVEREF(__pyx_v_self->c_tick_kwargs);
  PyTuple_SET_ITEM(__pyx_t_11, 14, __pyx_v_self->c_tick_kwargs);
  __Pyx_INCREF(__pyx_v_self->c_tick_method);
  __Pyx_GIVEREF(__pyx_v_self->c_tick_method);
  PyTuple_SET_ITEM(__pyx_t_11, 15, __pyx_v_self->c_tick_method);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_11, 16, __pyx_t_10);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._c_accs_clocks, self._c_ignore_type_checking, self._c_init_accs_depots, self._c_signals_at_step_t, self.c_accounts, self.c_lookback, self.c_merged_positions, self.c_merged_total_balances, self.c_name, self.c_positions, self.c_signals, self.c_strategy_func, self.c_strategy_kwargs, self.c_suppress_ticking, self.c_tick_kwargs, self.c_tick_method, self.c_total_balances)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_11 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v__dict = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "(tree fragment)":7
 *     state = (self._c_accs_clocks, self._c_ignore_type_checking, self._c_init_accs_depots, self._c_signals_at_step_t, self.c_accounts, self.c_lookback, self.c_merged_positions, self.c_merged_total_balances, self.c_name, self.c_positions, self.c_signals, self.c_strategy_func, self.c_strategy_kwargs, self.c_suppress_ticking, self.c_tick_kwargs, self.c_tick_method, self.c_total_balances)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_12 = (__pyx_v__dict != Py_None);
  __pyx_t_13 = (__pyx_t_12 != 0);
  if (__pyx_t_13) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v__dict);
    __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._c_accs_clocks is not None or self._c_init_accs_depots is not None or self.c_accounts is not None or self.c_strategy_func is not None or self.c_strategy_kwargs is not None or self.c_tick_kwargs is not None or self.c_tick_method is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._c_accs_clocks, self._c_ignore_type_checking, self._c_init_accs_depots, self._c_signals_at_step_t, self.c_accounts, self.c_lookback, self.c_merged_positions, self.c_merged_total_balances, self.c_name, self.c_positions, self.c_signals, self.c_strategy_func, self.c_strategy_kwargs, self.c_suppress_ticking, self.c_tick_kwargs, self.c_tick_method, self.c_total_balances)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._c_accs_clocks is not None or self._c_init_accs_depots is not None or self.c_accounts is not None or self.c_strategy_func is not None or self.c_strategy_kwargs is not None or self.c_tick_kwargs is not None or self.c_tick_method is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, None), state
 */
  /*else*/ {
    __pyx_t_12 = (__pyx_v_self->_c_accs_clocks != ((PyObject*)Py_None));
    __pyx_t_14 = (__pyx_t_12 != 0);
    if (!__pyx_t_14) {
    } else {
      __pyx_t_13 = __pyx_t_14;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_14 = (__pyx_v_self->_c_init_accs_depots != ((PyObject*)Py_None));
    __pyx_t_12 = (__pyx_t_14 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_13 = __pyx_t_12;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_self->c_accounts != ((PyObject*)Py_None));
    __pyx_t_14 = (__pyx_t_12 != 0);
    if (!__pyx_t_14) {
    } else {
      __pyx_t_13 = __pyx_t_14;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_14 = (__pyx_v_self->c_strategy_func != Py_None);
    __pyx_t_12 = (__pyx_t_14 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_13 = __pyx_t_12;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_self->c_strategy_kwargs != ((PyObject*)Py_None));
    __pyx_t_14 = (__pyx_t_12 != 0);
    if (!__pyx_t_14) {
    } else {
      __pyx_t_13 = __pyx_t_14;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_14 = (__pyx_v_self->c_tick_kwargs != ((PyObject*)Py_None));
    __pyx_t_12 = (__pyx_t_14 != 0);
    if (!__pyx_t_12) {
    } else {
      __pyx_t_13 = __pyx_t_12;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_self->c_tick_method != Py_None);
    __pyx_t_14 = (__pyx_t_12 != 0);
    __pyx_t_13 = __pyx_t_14;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_13;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._c_accs_clocks is not None or self._c_init_accs_depots is not None or self.c_accounts is not None or self.c_strategy_func is not None or self.c_strategy_kwargs is not None or self.c_tick_kwargs is not None or self.c_tick_method is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, None), state
 *     else:
 */
  __pyx_t_13 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_13) {

    /* "(tree fragment)":13
 *         use_setstate = self._c_accs_clocks is not None or self._c_init_accs_depots is not None or self.c_accounts is not None or self.c_strategy_func is not None or self.c_strategy_kwargs is not None or self.c_tick_kwargs is not None or self.c_tick_method is not None
 *     if use_setstate:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pyx_unpickle_cFXStrategy); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_50309536);
    __Pyx_GIVEREF(__pyx_int_50309536);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_50309536);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_11, 2, Py_None);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_state);
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._c_accs_clocks is not None or self._c_init_accs_depots is not None or self.c_accounts is not None or self.c_strategy_func is not None or self.c_strategy_kwargs is not None or self.c_tick_kwargs is not None or self.c_tick_method is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, None), state
 *     else:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_cFXStrategy__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_cFXStrategy); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_50309536);
    __Pyx_GIVEREF(__pyx_int_50309536);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_50309536);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_state);
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_cFXStrategy__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_43__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_43__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_42__setstate_cython__(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_11cFXStrategy_42__setstate_cython__(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_cFXStrategy__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy___pyx_unpickle_cFXStrategy__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_cFXStrategy, (type(self), 0x2ffa9a0, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_cFXStrategy__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.cFXStrategy.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1145
 * 
 *     @property
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return FXStrategy.name
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_1name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_name[] = "\n        Return FXStrategy.name\n        :return: str\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_1name = {"name", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_1name, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_name};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_1name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("name (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_name(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("name", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1150
 *         :return: str
 *         """
 *         return self.c_name.decode()             # <<<<<<<<<<<<<<
 *     @name.setter
 *     def name(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1145
 * 
 *     @property
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return FXStrategy.name
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1152
 *         return self.c_name.decode()
 *     @name.setter
 *     def name(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set FXStrategy.name
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_3name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_2name[] = "\n        Set FXStrategy.name\n        :param inp: str\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_3name = {"name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_3name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_2name};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_3name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("name (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("name", 1, 2, 2, 1); __PYX_ERR(0, 1152, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "name") < 0)) __PYX_ERR(0, 1152, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("name", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1152, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_2name(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_2name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("name", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1158
 *         :return: None
 *         """
 *         check_types([inp], [str], ['name setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_name = inp.encode()
 *     @name.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_name_setter);
  __Pyx_GIVEREF(__pyx_kp_u_name_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_name_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1159
 *         """
 *         check_types([inp], [str], ['name setter'], self._c_ignore_type_checking)
 *         self.c_name = inp.encode()             # <<<<<<<<<<<<<<
 *     @name.deleter
 *     def name(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_inp, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_name, __pyx_t_1) < 0) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1152
 *         return self.c_name.decode()
 *     @name.setter
 *     def name(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set FXStrategy.name
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1161
 *         self.c_name = inp.encode()
 *     @name.deleter
 *     def name(self):             # <<<<<<<<<<<<<<
 *         del self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_5name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_5name = {"name", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_5name, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_5name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("name (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_4name(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_4name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("name", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1162
 *     @name.deleter
 *     def name(self):
 *         del self.name             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_name) < 0) __PYX_ERR(0, 1162, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1161
 *         self.c_name = inp.encode()
 *     @name.deleter
 *     def name(self):             # <<<<<<<<<<<<<<
 *         del self.name
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1165
 * 
 *     @property
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of accounts contained in FXStrategy.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_7accounts(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_6accounts[] = "\n        Return list of accounts contained in FXStrategy.\n        :return: ProtectedList, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_7accounts = {"accounts", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_7accounts, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_6accounts};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_7accounts(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accounts (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_6accounts(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_6accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accounts", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1170
 *         :return: ProtectedList, immutable
 *         """
 *         return ProtectedList(self.c_accounts)             # <<<<<<<<<<<<<<
 *     @accounts.setter
 *     def accounts(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1165
 * 
 *     @property
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of accounts contained in FXStrategy.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1172
 *         return ProtectedList(self.c_accounts)
 *     @accounts.setter
 *     def accounts(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set list of accounts (use is not recommended, instead set proper list of accounts at __init__).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_9accounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_8accounts[] = "\n        Set list of accounts (use is not recommended, instead set proper list of accounts at __init__).\n        :param inp: list of FXAccount (or derived from BaseAccount) objects\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_9accounts = {"accounts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_9accounts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_8accounts};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_9accounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accounts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("accounts", 1, 2, 2, 1); __PYX_ERR(0, 1172, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accounts") < 0)) __PYX_ERR(0, 1172, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accounts", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_8accounts(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_8accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accounts", 0);
  __Pyx_INCREF(__pyx_v_inp);

  /* "trapeza/strategy/fx_strategy.pyx":1178
 *         :return: None
 *         """
 *         check_types([inp], [list], ['account setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if not self._c_ignore_type_checking:
 *             inp = self._check_parse_accounts(inp)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_account_setter);
  __Pyx_GIVEREF(__pyx_kp_u_account_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_account_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1179
 *         """
 *         check_types([inp], [list], ['account setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             inp = self._check_parse_accounts(inp)
 *         self.c_accounts = inp
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1180
 *         check_types([inp], [list], ['account setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             inp = self._check_parse_accounts(inp)             # <<<<<<<<<<<<<<
 *         self.c_accounts = inp
 *     @accounts.deleter
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_parse_accounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inp);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_inp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1179
 *         """
 *         check_types([inp], [list], ['account setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             inp = self._check_parse_accounts(inp)
 *         self.c_accounts = inp
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1181
 *         if not self._c_ignore_type_checking:
 *             inp = self._check_parse_accounts(inp)
 *         self.c_accounts = inp             # <<<<<<<<<<<<<<
 *     @accounts.deleter
 *     def accounts(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_accounts, __pyx_v_inp) < 0) __PYX_ERR(0, 1181, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1172
 *         return ProtectedList(self.c_accounts)
 *     @accounts.setter
 *     def accounts(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set list of accounts (use is not recommended, instead set proper list of accounts at __init__).
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_inp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1183
 *         self.c_accounts = inp
 *     @accounts.deleter
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         del self.accounts
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_11accounts(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_11accounts = {"accounts", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_11accounts, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_11accounts(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accounts (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_10accounts(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_10accounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accounts", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1184
 *     @accounts.deleter
 *     def accounts(self):
 *         del self.accounts             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_accounts) < 0) __PYX_ERR(0, 1184, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1183
 *         self.c_accounts = inp
 *     @accounts.deleter
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         del self.accounts
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1187
 * 
 *     @property
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns FXStrategy.lookback. This denotes the historic lookback data, which is available at time step 0.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_13lookback(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_12lookback[] = "\n        Returns FXStrategy.lookback. This denotes the historic lookback data, which is available at time step 0.\n        See docstring of FXStrategy class.\n        :return: int\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_13lookback = {"lookback", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_13lookback, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_12lookback};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_13lookback(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookback (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_12lookback(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_12lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookback", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1193
 *         :return: int
 *         """
 *         return self.c_lookback             # <<<<<<<<<<<<<<
 *     @lookback.setter
 *     def lookback(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_lookback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1187
 * 
 *     @property
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns FXStrategy.lookback. This denotes the historic lookback data, which is available at time step 0.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.lookback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1195
 *         return self.c_lookback
 *     @lookback.setter
 *     def lookback(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new lookback
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_15lookback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_14lookback[] = "\n        Set new lookback\n        :param inp: int\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_15lookback = {"lookback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_15lookback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_14lookback};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_15lookback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookback", 1, 2, 2, 1); __PYX_ERR(0, 1195, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookback") < 0)) __PYX_ERR(0, 1195, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1195, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.lookback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_14lookback(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_14lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookback", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1201
 *         :return: None
 *         """
 *         check_types([inp], [int], ['lookback setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_lookback = inp
 *     @lookback.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyInt_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_lookback_setter);
  __Pyx_GIVEREF(__pyx_kp_u_lookback_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_lookback_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1202
 *         """
 *         check_types([inp], [int], ['lookback setter'], self._c_ignore_type_checking)
 *         self.c_lookback = inp             # <<<<<<<<<<<<<<
 *     @lookback.deleter
 *     def lookback(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_lookback, __pyx_v_inp) < 0) __PYX_ERR(0, 1202, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1195
 *         return self.c_lookback
 *     @lookback.setter
 *     def lookback(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new lookback
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.lookback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1204
 *         self.c_lookback = inp
 *     @lookback.deleter
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         del self.lookback
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_17lookback(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_17lookback = {"lookback", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_17lookback, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_17lookback(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookback (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_16lookback(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_16lookback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookback", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1205
 *     @lookback.deleter
 *     def lookback(self):
 *         del self.lookback             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_lookback) < 0) __PYX_ERR(0, 1205, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1204
 *         self.c_lookback = inp
 *     @lookback.deleter
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         del self.lookback
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.lookback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1208
 * 
 *     @property
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns status if ticking of accounts is suppressed (=True) or if accounts are automatically ticked during
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_19suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_18suppress_ticking[] = "\n        Returns status if ticking of accounts is suppressed (=True) or if accounts are automatically ticked during\n        FXStrategy.run (=False)\n        :return: bool\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_19suppress_ticking = {"suppress_ticking", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_19suppress_ticking, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_18suppress_ticking};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_19suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("suppress_ticking (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_18suppress_ticking(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_18suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("suppress_ticking", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1214
 *         :return: bool
 *         """
 *         return self.c_suppress_ticking             # <<<<<<<<<<<<<<
 *     @suppress_ticking.setter
 *     def suppress_ticking(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_suppress_ticking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1208
 * 
 *     @property
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns status if ticking of accounts is suppressed (=True) or if accounts are automatically ticked during
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.suppress_ticking", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1216
 *         return self.c_suppress_ticking
 *     @suppress_ticking.setter
 *     def suppress_ticking(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new status whether to suppress automatic ticking (=True).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_21suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_20suppress_ticking[] = "\n        Set new status whether to suppress automatic ticking (=True).\n        :param inp: bool\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_21suppress_ticking = {"suppress_ticking", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_21suppress_ticking, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_20suppress_ticking};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_21suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("suppress_ticking (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("suppress_ticking", 1, 2, 2, 1); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "suppress_ticking") < 0)) __PYX_ERR(0, 1216, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("suppress_ticking", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.suppress_ticking", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_20suppress_ticking(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_20suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("suppress_ticking", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1222
 *         :return: None
 *         """
 *         check_types([inp], [bool], ['suppress_ticking setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject*)&PyBool_Type));
  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject*)&PyBool_Type));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_suppress_ticking_setter);
  __Pyx_GIVEREF(__pyx_kp_u_suppress_ticking_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_suppress_ticking_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1223
 *         """
 *         check_types([inp], [bool], ['suppress_ticking setter'], self._c_ignore_type_checking)
 *         self.c_suppress_ticking = inp             # <<<<<<<<<<<<<<
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_suppress_ticking, __pyx_v_inp) < 0) __PYX_ERR(0, 1223, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1216
 *         return self.c_suppress_ticking
 *     @suppress_ticking.setter
 *     def suppress_ticking(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new status whether to suppress automatic ticking (=True).
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.suppress_ticking", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1225
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         del self.suppress_ticking
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_23suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_23suppress_ticking = {"suppress_ticking", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_23suppress_ticking, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_23suppress_ticking(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("suppress_ticking (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_22suppress_ticking(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_22suppress_ticking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("suppress_ticking", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1226
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):
 *         del self.suppress_ticking             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_suppress_ticking) < 0) __PYX_ERR(0, 1226, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1225
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         del self.suppress_ticking
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.suppress_ticking", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1229
 * 
 *     @property
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for strategy decision function. See docstring of FXStrategy class for further details.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_25strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_24strategy_kwargs[] = "\n        Returns kwargs for strategy decision function. See docstring of FXStrategy class for further details.\n        :return: Protected dict, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_25strategy_kwargs = {"strategy_kwargs", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_25strategy_kwargs, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_24strategy_kwargs};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_25strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_kwargs (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_24strategy_kwargs(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_24strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1234
 *         :return: Protected dict, immutable
 *         """
 *         return ProtectedDict(self.c_strategy_kwargs)             # <<<<<<<<<<<<<<
 *     @strategy_kwargs.setter
 *     def strategy_kwargs(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_strategy_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1229
 * 
 *     @property
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for strategy decision function. See docstring of FXStrategy class for further details.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1236
 *         return ProtectedDict(self.c_strategy_kwargs)
 *     @strategy_kwargs.setter
 *     def strategy_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for strategy decision function. See docstring of FXStrategy class for further details.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_27strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_26strategy_kwargs[] = "\n        Set a new kwargs dict for strategy decision function. See docstring of FXStrategy class for further details.\n        :param inp: dict\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_27strategy_kwargs = {"strategy_kwargs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_27strategy_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_26strategy_kwargs};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_27strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_kwargs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strategy_kwargs", 1, 2, 2, 1); __PYX_ERR(0, 1236, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strategy_kwargs") < 0)) __PYX_ERR(0, 1236, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strategy_kwargs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1236, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_26strategy_kwargs(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_26strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1242
 *         :return: None
 *         """
 *         check_types([inp], [dict], ['strategy_kwargs setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyDict_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_strategy_kwargs_setter);
  __Pyx_GIVEREF(__pyx_kp_u_strategy_kwargs_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_strategy_kwargs_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1243
 *         """
 *         check_types([inp], [dict], ['strategy_kwargs setter'], self._c_ignore_type_checking)
 *         self.c_strategy_kwargs = inp             # <<<<<<<<<<<<<<
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_strategy_kwargs, __pyx_v_inp) < 0) __PYX_ERR(0, 1243, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1236
 *         return ProtectedDict(self.c_strategy_kwargs)
 *     @strategy_kwargs.setter
 *     def strategy_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for strategy decision function. See docstring of FXStrategy class for further details.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1245
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_strategy_kwargs
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_29strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_29strategy_kwargs = {"strategy_kwargs", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_29strategy_kwargs, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_29strategy_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_kwargs (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_28strategy_kwargs(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_28strategy_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1246
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):
 *         del self.c_strategy_kwargs             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_c_strategy_kwargs) < 0) __PYX_ERR(0, 1246, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1245
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_strategy_kwargs
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1249
 * 
 *     @property
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_31tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_30tick_kwargs[] = "\n        Returns kwargs for (alternative) ticking method. See docstring of FXStrategy class for further details.\n        :return: Protected dict, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_31tick_kwargs = {"tick_kwargs", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_31tick_kwargs, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_30tick_kwargs};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_31tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_kwargs (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_30tick_kwargs(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_30tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1254
 *         :return: Protected dict, immutable
 *         """
 *         return ProtectedDict(self.c_tick_kwargs)             # <<<<<<<<<<<<<<
 *     @tick_kwargs.setter
 *     def tick_kwargs(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_tick_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1249
 * 
 *     @property
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1256
 *         return ProtectedDict(self.c_tick_kwargs)
 *     @tick_kwargs.setter
 *     def tick_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_33tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_32tick_kwargs[] = "\n        Set a new kwargs dict for (alternative) ticking method. See docstring of FXStrategy class for further details.\n        :param inp: dict\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_33tick_kwargs = {"tick_kwargs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_33tick_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_32tick_kwargs};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_33tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_kwargs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tick_kwargs", 1, 2, 2, 1); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tick_kwargs") < 0)) __PYX_ERR(0, 1256, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tick_kwargs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_32tick_kwargs(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_32tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1262
 *         :return: None
 *         """
 *         check_types([inp], [dict], ['tick_kwargs setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyDict_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_tick_kwargs_setter);
  __Pyx_GIVEREF(__pyx_kp_u_tick_kwargs_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_tick_kwargs_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1263
 *         """
 *         check_types([inp], [dict], ['tick_kwargs setter'], self._c_ignore_type_checking)
 *         self.c_tick_kwargs = inp             # <<<<<<<<<<<<<<
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_tick_kwargs, __pyx_v_inp) < 0) __PYX_ERR(0, 1263, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1256
 *         return ProtectedDict(self.c_tick_kwargs)
 *     @tick_kwargs.setter
 *     def tick_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1265
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_tick_kwargs
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_35tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_35tick_kwargs = {"tick_kwargs", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_35tick_kwargs, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_35tick_kwargs(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_kwargs (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_34tick_kwargs(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_34tick_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_kwargs", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1266
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):
 *         del self.c_tick_kwargs             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_c_tick_kwargs) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1265
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_tick_kwargs
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1269
 * 
 *     @property
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns strategy decision function (as object).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_37strategy_func(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_36strategy_func[] = "\n        Returns strategy decision function (as object).\n        :return: callable function object\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_37strategy_func = {"strategy_func", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_37strategy_func, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_36strategy_func};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_37strategy_func(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_func (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_36strategy_func(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_36strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_func", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1274
 *         :return: callable function object
 *         """
 *         return self.c_strategy_func             # <<<<<<<<<<<<<<
 *     @strategy_func.setter
 *     def strategy_func(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_strategy_func); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1269
 * 
 *     @property
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns strategy decision function (as object).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1276
 *         return self.c_strategy_func
 *     @strategy_func.setter
 *     def strategy_func(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new strategy decision function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_39strategy_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_38strategy_func[] = "\n        Set new strategy decision function.\n        :param inp: callable function object\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_39strategy_func = {"strategy_func", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_39strategy_func, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_38strategy_func};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_39strategy_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strategy_func", 1, 2, 2, 1); __PYX_ERR(0, 1276, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strategy_func") < 0)) __PYX_ERR(0, 1276, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strategy_func", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_38strategy_func(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_38strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_func", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1282
 *         :return: None
 *         """
 *         check_types([inp], [callable], ['strategy_func setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = __Pyx_GetBuiltinName(__pyx_n_s_callable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_u_strategy_func_setter);
  __Pyx_GIVEREF(__pyx_kp_u_strategy_func_setter);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_strategy_func_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1283
 *         """
 *         check_types([inp], [callable], ['strategy_func setter'], self._c_ignore_type_checking)
 *         self.c_strategy_func = inp             # <<<<<<<<<<<<<<
 *     @strategy_func.deleter
 *     def strategy_func(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_strategy_func, __pyx_v_inp) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1276
 *         return self.c_strategy_func
 *     @strategy_func.setter
 *     def strategy_func(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new strategy decision function.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1285
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         del self.strategy_func
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_41strategy_func(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_41strategy_func = {"strategy_func", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_41strategy_func, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_41strategy_func(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strategy_func (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_40strategy_func(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_40strategy_func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strategy_func", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1286
 *     @strategy_func.deleter
 *     def strategy_func(self):
 *         del self.strategy_func             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_strategy_func) < 0) __PYX_ERR(0, 1286, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1285
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         del self.strategy_func
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.strategy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1289
 * 
 *     @property
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns (alternative) ticking method for accounts.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_43tick_method(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_42tick_method[] = "\n        Returns (alternative) ticking method for accounts.\n        :return: callable function object\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_43tick_method = {"tick_method", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_43tick_method, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_42tick_method};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_43tick_method(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_method (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_42tick_method(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_42tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_method", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1294
 *         :return: callable function object
 *         """
 *         return self.c_tick_method             # <<<<<<<<<<<<<<
 *     @tick_method.setter
 *     def tick_method(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_tick_method); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1289
 * 
 *     @property
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns (alternative) ticking method for accounts.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1296
 *         return self.c_tick_method
 *     @tick_method.setter
 *     def tick_method(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new (alternative) ticking method for accounts.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_45tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_44tick_method[] = "\n        Set new (alternative) ticking method for accounts.\n        :param inp: callable function object\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_45tick_method = {"tick_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_45tick_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_44tick_method};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_45tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_method (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tick_method", 1, 2, 2, 1); __PYX_ERR(0, 1296, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tick_method") < 0)) __PYX_ERR(0, 1296, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tick_method", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1296, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_44tick_method(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_44tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_method", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1302
 *         :return: None
 *         """
 *         check_types([inp], [callable], ['tick_func setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.c_tick_method = inp
 *     @tick_method.deleter
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = __Pyx_GetBuiltinName(__pyx_n_s_callable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_u_tick_func_setter);
  __Pyx_GIVEREF(__pyx_kp_u_tick_func_setter);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_tick_func_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1303
 *         """
 *         check_types([inp], [callable], ['tick_func setter'], self._c_ignore_type_checking)
 *         self.c_tick_method = inp             # <<<<<<<<<<<<<<
 *     @tick_method.deleter
 *     def tick_method(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_tick_method, __pyx_v_inp) < 0) __PYX_ERR(0, 1303, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1296
 *         return self.c_tick_method
 *     @tick_method.setter
 *     def tick_method(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new (alternative) ticking method for accounts.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1305
 *         self.c_tick_method = inp
 *     @tick_method.deleter
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         del self.tick_method
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_47tick_method(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_47tick_method = {"tick_method", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_47tick_method, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_47tick_method(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tick_method (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_46tick_method(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_46tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tick_method", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1306
 *     @tick_method.deleter
 *     def tick_method(self):
 *         del self.tick_method             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_tick_method) < 0) __PYX_ERR(0, 1306, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1305
 *         self.c_tick_method = inp
 *     @tick_method.deleter
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         del self.tick_method
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1309
 * 
 *     @property
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return initial depot states of all accounts contained in FXStrategy.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_49_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_48_init_accs_depots[] = "\n        Return initial depot states of all accounts contained in FXStrategy.\n        :return: ProtectedList of dicts, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_49_init_accs_depots = {"_init_accs_depots", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_49_init_accs_depots, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_48_init_accs_depots};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_49_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_accs_depots (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_48_init_accs_depots(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_48_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_accs_depots", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1314
 *         :return: ProtectedList of dicts, immutable
 *         """
 *         return ProtectedList(self._c_init_accs_depots)             # <<<<<<<<<<<<<<
 *     @_init_accs_depots.setter
 *     def _init_accs_depots(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_init_accs_depots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1309
 * 
 *     @property
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return initial depot states of all accounts contained in FXStrategy.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_accs_depots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1316
 *         return ProtectedList(self._c_init_accs_depots)
 *     @_init_accs_depots.setter
 *     def _init_accs_depots(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new initial depot states of all accounts contained in FXStrategy.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_51_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_50_init_accs_depots[] = "\n        Set new initial depot states of all accounts contained in FXStrategy.\n        :param inp: list of dicts, see FXAccount for further information on dict structure for account's depot\n                    dict with str:currency (or asset) as key and float (position size) as value\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_51_init_accs_depots = {"_init_accs_depots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_51_init_accs_depots, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_50_init_accs_depots};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_51_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_accs_depots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_init_accs_depots", 1, 2, 2, 1); __PYX_ERR(0, 1316, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_accs_depots") < 0)) __PYX_ERR(0, 1316, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_init_accs_depots", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1316, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_accs_depots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_50_init_accs_depots(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_50_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_accs_depots", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1323
 *         :return: None
 *         """
 *         check_types([inp], [list], ['_init_accs_depots setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if not self._c_ignore_type_checking:
 *             for i in inp:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_init_accs_depots_setter);
  __Pyx_GIVEREF(__pyx_kp_u_init_accs_depots_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_init_accs_depots_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1324
 *         """
 *         check_types([inp], [list], ['_init_accs_depots setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for i in inp:
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1324, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1325
 *         check_types([inp], [list], ['_init_accs_depots setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for i in inp:             # <<<<<<<<<<<<<<
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 *                             self._c_ignore_type_checking)
 */
    if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
      __pyx_t_1 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1325, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1325, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1325, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1325, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1326
 *         if not self._c_ignore_type_checking:
 *             for i in inp:
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *         self._c_init_accs_depots = inp
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_check_types); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_i);
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
      PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyDict_Type)));
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_init_accs_depots_setter_list_mu);
      __Pyx_GIVEREF(__pyx_kp_u_init_accs_depots_setter_list_mu);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_init_accs_depots_setter_list_mu);

      /* "trapeza/strategy/fx_strategy.pyx":1327
 *             for i in inp:
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1325
 *         check_types([inp], [list], ['_init_accs_depots setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for i in inp:             # <<<<<<<<<<<<<<
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 *                             self._c_ignore_type_checking)
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1324
 *         """
 *         check_types([inp], [list], ['_init_accs_depots setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for i in inp:
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1328
 *                 check_types([i], [dict], ['_init_accs_depots setter list must contain dicts'],
 *                             self._c_ignore_type_checking)
 *         self._c_init_accs_depots = inp             # <<<<<<<<<<<<<<
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_init_accs_depots, __pyx_v_inp) < 0) __PYX_ERR(0, 1328, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1316
 *         return ProtectedList(self._c_init_accs_depots)
 *     @_init_accs_depots.setter
 *     def _init_accs_depots(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new initial depot states of all accounts contained in FXStrategy.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_accs_depots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1330
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         del self._init_accs_depots
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_53_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_53_init_accs_depots = {"_init_accs_depots", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_53_init_accs_depots, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_53_init_accs_depots(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_accs_depots (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_52_init_accs_depots(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_52_init_accs_depots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_accs_depots", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1331
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):
 *         del self._init_accs_depots             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_init_accs_depots) < 0) __PYX_ERR(0, 1331, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1330
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         del self._init_accs_depots
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_accs_depots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1334
 * 
 *     @property
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of all accounts' clocks (current time steps per account).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_55_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_54_accs_clocks[] = "\n        Return list of all accounts' clocks (current time steps per account).\n        :return: ProtectedList, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_55_accs_clocks = {"_accs_clocks", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_55_accs_clocks, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_54_accs_clocks};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_55_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_accs_clocks (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_54_accs_clocks(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_54_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_accs_clocks", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1339
 *         :return: ProtectedList, immutable
 *         """
 *         return ProtectedList(self._c_accs_clocks)             # <<<<<<<<<<<<<<
 *     @_accs_clocks.setter
 *     def _accs_clocks(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_accs_clocks); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1334
 * 
 *     @property
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of all accounts' clocks (current time steps per account).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._accs_clocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1341
 *         return ProtectedList(self._c_accs_clocks)
 *     @_accs_clocks.setter
 *     def _accs_clocks(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of all accounts' clocks (current time step per account)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_57_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_56_accs_clocks[] = "\n        Set new list of all accounts' clocks (current time step per account)\n        :param inp: list of ints\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_57_accs_clocks = {"_accs_clocks", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_57_accs_clocks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_56_accs_clocks};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_57_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_accs_clocks (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_accs_clocks", 1, 2, 2, 1); __PYX_ERR(0, 1341, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_accs_clocks") < 0)) __PYX_ERR(0, 1341, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_accs_clocks", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1341, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._accs_clocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_56_accs_clocks(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_56_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_accs_clocks", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1347
 *         :return: None
 *         """
 *         check_types([inp], [list], ['_accs_clocks setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if not self._c_ignore_type_checking:
 *             for i in inp:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_accs_clocks_setter);
  __Pyx_GIVEREF(__pyx_kp_u_accs_clocks_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_accs_clocks_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1348
 *         """
 *         check_types([inp], [list], ['_accs_clocks setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for i in inp:
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1349
 *         check_types([inp], [list], ['_accs_clocks setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for i in inp:             # <<<<<<<<<<<<<<
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 *                             self._c_ignore_type_checking)
 */
    if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
      __pyx_t_1 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1349, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1349, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1349, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1349, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1350
 *         if not self._c_ignore_type_checking:
 *             for i in inp:
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *         self._c_accs_clocks = inp
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_check_types); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_i);
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyInt_Type)));
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_accs_clocks_setter_list_must_co);
      __Pyx_GIVEREF(__pyx_kp_u_accs_clocks_setter_list_must_co);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_accs_clocks_setter_list_must_co);

      /* "trapeza/strategy/fx_strategy.pyx":1351
 *             for i in inp:
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1349
 *         check_types([inp], [list], ['_accs_clocks setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for i in inp:             # <<<<<<<<<<<<<<
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 *                             self._c_ignore_type_checking)
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1348
 *         """
 *         check_types([inp], [list], ['_accs_clocks setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for i in inp:
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1352
 *                 check_types([i], [int], ['_accs_clocks setter list must contain floats'],
 *                             self._c_ignore_type_checking)
 *         self._c_accs_clocks = inp             # <<<<<<<<<<<<<<
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c_accs_clocks, __pyx_v_inp) < 0) __PYX_ERR(0, 1352, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1341
 *         return ProtectedList(self._c_accs_clocks)
 *     @_accs_clocks.setter
 *     def _accs_clocks(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of all accounts' clocks (current time step per account)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._accs_clocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1354
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         del self._accs_clocks
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_59_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_59_accs_clocks = {"_accs_clocks", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_59_accs_clocks, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_59_accs_clocks(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_accs_clocks (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_58_accs_clocks(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_58_accs_clocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_accs_clocks", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1355
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):
 *         del self._accs_clocks             # <<<<<<<<<<<<<<
 * 
 *     # protected
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_accs_clocks) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1354
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         del self._accs_clocks
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._accs_clocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1359
 *     # protected
 *     @property
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.positions. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_61positions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_60positions[] = "\n        Returns dict of self.positions. See docstring of FXStrategy class for further information.\n        :return: ProtectedDict, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_61positions = {"positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_61positions, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_60positions};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_61positions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_60positions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_60positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1364
 *         :return: ProtectedDict, immutable
 *         """
 *         return ProtectedDict(self.self_parse_positions())             # <<<<<<<<<<<<<<
 *     @positions.setter
 *     def positions(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_positions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1359
 *     # protected
 *     @property
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.positions. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1366
 *         return ProtectedDict(self.self_parse_positions())
 *     @positions.setter
 *     def positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of positions to self.positions. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_63positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_62positions[] = "\n        Set new dict of positions to self.positions. See docstring of FXStrategy class for further information.\n        :param inp: dict,\n                    key: str (currency or asset)\n                    value: list of lists floats (list at every time step consisting of lists of position sizes for\n                           each account)\n                    See docstring of FXStrategy class for further information.\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_63positions = {"positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_63positions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_62positions};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_63positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("positions", 1, 2, 2, 1); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "positions") < 0)) __PYX_ERR(0, 1366, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("positions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_62positions(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_62positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1376
 *         :return: None
 *         """
 *         check_types([inp], [dict], ['position setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyDict_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_position_setter);
  __Pyx_GIVEREF(__pyx_kp_u_position_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_position_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1377
 *         """
 *         check_types([inp], [dict], ['position setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for k, v in inp:
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1378
 *         check_types([inp], [dict], ['position setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:             # <<<<<<<<<<<<<<
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],
 *                             self._c_ignore_type_checking)
 */
    if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
      __pyx_t_1 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1378, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1378, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1378, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1378, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1378, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_6 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1378, __pyx_L1_error)
        __pyx_t_14 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_14 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1378, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1379
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *                 # sample checks
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_k);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyList_SET_ITEM(__pyx_t_9, 1, __pyx_v_v);
      __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
      PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyUnicode_Type)));
      __Pyx_INCREF(((PyObject *)(&PyList_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
      PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyList_Type)));
      __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_key_in_position_setter_dict);
      __Pyx_GIVEREF(__pyx_kp_u_key_in_position_setter_dict);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_key_in_position_setter_dict);
      __Pyx_INCREF(__pyx_kp_u_value_in_position_setter_dict);
      __Pyx_GIVEREF(__pyx_kp_u_value_in_position_setter_dict);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_value_in_position_setter_dict);

      /* "trapeza/strategy/fx_strategy.pyx":1380
 *             for k, v in inp:
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 # sample checks
 *                 check_types([v[0]], [list], ['time step list in value of position setter dict'],
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1379, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_8, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_8, __pyx_t_3);
        __pyx_t_9 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1382
 *                             self._c_ignore_type_checking)
 *                 # sample checks
 *                 check_types([v[0]], [list], ['time step list in value of position setter dict'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *                 check_types([v[0][0]], [float], ['float value in time step list as value of position setter dict'],
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(((PyObject *)(&PyList_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
      PyList_SET_ITEM(__pyx_t_15, 0, ((PyObject *)(&PyList_Type)));
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_time_step_list_in_value_of_posit);
      __Pyx_GIVEREF(__pyx_kp_u_time_step_list_in_value_of_posit);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_time_step_list_in_value_of_posit);

      /* "trapeza/strategy/fx_strategy.pyx":1383
 *                 # sample checks
 *                 check_types([v[0]], [list], ['time step list in value of position setter dict'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 check_types([v[0][0]], [float], ['float value in time step list as value of position setter dict'],
 *                             self._c_ignore_type_checking)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_3, __pyx_t_15, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_3, __pyx_t_15, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_5);
        __pyx_t_3 = 0;
        __pyx_t_15 = 0;
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1384
 *                 check_types([v[0]], [list], ['time step list in value of position setter dict'],
 *                             self._c_ignore_type_checking)
 *                 check_types([v[0][0]], [float], ['float value in time step list as value of position setter dict'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *         self.position_from_py(inp)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
      PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyFloat_Type)));
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_float_value_in_time_step_list_as);
      __Pyx_GIVEREF(__pyx_kp_u_float_value_in_time_step_list_as);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_float_value_in_time_step_list_as);

      /* "trapeza/strategy/fx_strategy.pyx":1385
 *                             self._c_ignore_type_checking)
 *                 check_types([v[0][0]], [float], ['float value in time step list as value of position setter dict'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.position_from_py(inp)
 *     @positions.deleter
 */
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1385, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_t_15};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1384, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_7, __pyx_t_5, __pyx_t_4, __pyx_t_15};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1384, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_15);
        __pyx_t_7 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_15 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1378
 *         check_types([inp], [dict], ['position setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:             # <<<<<<<<<<<<<<
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],
 *                             self._c_ignore_type_checking)
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1377
 *         """
 *         check_types([inp], [dict], ['position setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for k, v in inp:
 *                 check_types([k, v], [str, list], ['key in position setter dict', 'value in position setter dict'],
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1386
 *                 check_types([v[0][0]], [float], ['float value in time step list as value of position setter dict'],
 *                             self._c_ignore_type_checking)
 *         self.position_from_py(inp)             # <<<<<<<<<<<<<<
 *     @positions.deleter
 *     def positions(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_position_from_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1366
 *         return ProtectedDict(self.self_parse_positions())
 *     @positions.setter
 *     def positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of positions to self.positions. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1388
 *         self.position_from_py(inp)
 *     @positions.deleter
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         del self.positions
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_65positions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_65positions = {"positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_65positions, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_65positions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_64positions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_64positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1389
 *     @positions.deleter
 *     def positions(self):
 *         del self.positions             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_positions) < 0) __PYX_ERR(0, 1389, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1388
 *         self.position_from_py(inp)
 *     @positions.deleter
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         del self.positions
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1392
 * 
 *     @property
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.merged_positions. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_67merged_positions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_66merged_positions[] = "\n        Returns dict of self.merged_positions. See docstring of FXStrategy class for further information.\n        :return: ProtectedDict, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_67merged_positions = {"merged_positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_67merged_positions, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_66merged_positions};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_67merged_positions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_66merged_positions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_66merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1397
 *         :return: ProtectedDict, immutable
 *         """
 *         return ProtectedDict(self.self_parse_merged_positions())             # <<<<<<<<<<<<<<
 *     @merged_positions.setter
 *     def merged_positions(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_merged_positions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1392
 * 
 *     @property
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.merged_positions. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1399
 *         return ProtectedDict(self.self_parse_merged_positions())
 *     @merged_positions.setter
 *     def merged_positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of merged_positions to self.merged_positions. See docstring of FXStrategy class for
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_69merged_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_68merged_positions[] = "\n        Set new dict of merged_positions to self.merged_positions. See docstring of FXStrategy class for\n        further information.\n        :param inp: dict,\n                    key: str (currency or asset)\n                    value: list of floats (position size over all accounts at every time step)\n                    See docstring of FXStrategy class for further information.\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_69merged_positions = {"merged_positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_69merged_positions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_68merged_positions};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_69merged_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merged_positions", 1, 2, 2, 1); __PYX_ERR(0, 1399, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merged_positions") < 0)) __PYX_ERR(0, 1399, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merged_positions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_68merged_positions(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_68merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1409
 *         :return: None
 *         """
 *         check_types([inp], [dict], ['merged_positions setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyDict_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_merged_positions_setter);
  __Pyx_GIVEREF(__pyx_kp_u_merged_positions_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_merged_positions_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1410
 *         """
 *         check_types([inp], [dict], ['merged_positions setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for k, v in inp:
 *                 check_types([k, v], [str, list],
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1411
 *         check_types([inp], [dict], ['merged_positions setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:             # <<<<<<<<<<<<<<
 *                 check_types([k, v], [str, list],
 *                             ['key in merged_positions setter dict', 'value in merged_positions setter dict'],
 */
    if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
      __pyx_t_1 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1411, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1411, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1411, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1411, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1411, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1411, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_6 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1411, __pyx_L1_error)
        __pyx_t_14 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_14 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1411, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1412
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:
 *                 check_types([k, v], [str, list],             # <<<<<<<<<<<<<<
 *                             ['key in merged_positions setter dict', 'value in merged_positions setter dict'],
 *                             self._c_ignore_type_checking)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_k);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyList_SET_ITEM(__pyx_t_9, 1, __pyx_v_v);
      __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
      PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyUnicode_Type)));
      __Pyx_INCREF(((PyObject *)(&PyList_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
      PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyList_Type)));

      /* "trapeza/strategy/fx_strategy.pyx":1413
 *             for k, v in inp:
 *                 check_types([k, v], [str, list],
 *                             ['key in merged_positions setter dict', 'value in merged_positions setter dict'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *                 # sample check
 */
      __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1413, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_key_in_merged_positions_setter_d);
      __Pyx_GIVEREF(__pyx_kp_u_key_in_merged_positions_setter_d);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_key_in_merged_positions_setter_d);
      __Pyx_INCREF(__pyx_kp_u_value_in_merged_positions_setter);
      __Pyx_GIVEREF(__pyx_kp_u_value_in_merged_positions_setter);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_value_in_merged_positions_setter);

      /* "trapeza/strategy/fx_strategy.pyx":1414
 *                 check_types([k, v], [str, list],
 *                             ['key in merged_positions setter dict', 'value in merged_positions setter dict'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 # sample check
 *                 check_types([v[0]], [float], ['float value in value list of merged_positions setter dict'],
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1412, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_5, __pyx_t_4, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1412, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1412, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_8, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_8, __pyx_t_3);
        __pyx_t_9 = 0;
        __pyx_t_5 = 0;
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1412, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1416
 *                             self._c_ignore_type_checking)
 *                 # sample check
 *                 check_types([v[0]], [float], ['float value in value list of merged_positions setter dict'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *         self.merged_positions_from_py(inp)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
      PyList_SET_ITEM(__pyx_t_15, 0, ((PyObject *)(&PyFloat_Type)));
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_kp_u_float_value_in_value_list_of_mer);
      __Pyx_GIVEREF(__pyx_kp_u_float_value_in_value_list_of_mer);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_float_value_in_value_list_of_mer);

      /* "trapeza/strategy/fx_strategy.pyx":1417
 *                 # sample check
 *                 check_types([v[0]], [float], ['float value in value list of merged_positions setter dict'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_3, __pyx_t_15, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1416, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_3, __pyx_t_15, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1416, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1416, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_5);
        __pyx_t_3 = 0;
        __pyx_t_15 = 0;
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1416, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1411
 *         check_types([inp], [dict], ['merged_positions setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:
 *             for k, v in inp:             # <<<<<<<<<<<<<<
 *                 check_types([k, v], [str, list],
 *                             ['key in merged_positions setter dict', 'value in merged_positions setter dict'],
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1410
 *         """
 *         check_types([inp], [dict], ['merged_positions setter'], self._c_ignore_type_checking)
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             for k, v in inp:
 *                 check_types([k, v], [str, list],
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1418
 *                 check_types([v[0]], [float], ['float value in value list of merged_positions setter dict'],
 *                             self._c_ignore_type_checking)
 *         self.merged_positions_from_py(inp)             # <<<<<<<<<<<<<<
 *     @merged_positions.deleter
 *     def merged_positions(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_merged_positions_from_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1399
 *         return ProtectedDict(self.self_parse_merged_positions())
 *     @merged_positions.setter
 *     def merged_positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of merged_positions to self.merged_positions. See docstring of FXStrategy class for
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1420
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         del self.merged_positions
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_71merged_positions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_71merged_positions = {"merged_positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_71merged_positions, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_71merged_positions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_positions (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_70merged_positions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_70merged_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1421
 *     @merged_positions.deleter
 *     def merged_positions(self):
 *         del self.merged_positions             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_merged_positions) < 0) __PYX_ERR(0, 1421, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1420
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         del self.merged_positions
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1424
 * 
 *     @property
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.total_balances. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_73total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_72total_balances[] = "\n        Returns list of self.total_balances. See docstring of FXStrategy class for further information.\n        :return: ProtectedList, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_73total_balances = {"total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_73total_balances, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_72total_balances};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_73total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_72total_balances(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_72total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1429
 *         :return: ProtectedList, immutable
 *         """
 *         return ProtectedList(self.self_parse_total_balances())             # <<<<<<<<<<<<<<
 *     @total_balances.setter
 *     def total_balances(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_total_balances); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1424
 * 
 *     @property
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.total_balances. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1431
 *         return ProtectedList(self.self_parse_total_balances())
 *     @total_balances.setter
 *     def total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of total_balances to self.total_balances. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_75total_balances(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_74total_balances[] = "\n        Set new list of total_balances to self.total_balances. See docstring of FXStrategy class for further information.\n        :param inp: list of list of floats, lists at every time step of lists of total_balances for each account.\n                    See docstring of FXStrategy class for further information.\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_75total_balances = {"total_balances", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_75total_balances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_74total_balances};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_75total_balances(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("total_balances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("total_balances", 1, 2, 2, 1); __PYX_ERR(0, 1431, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "total_balances") < 0)) __PYX_ERR(0, 1431, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("total_balances", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1431, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_74total_balances(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_74total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1438
 *         :return: None
 *         """
 *         check_types([inp], [list], ['total_balances setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, float],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_total_balances_setter);
  __Pyx_GIVEREF(__pyx_kp_u_total_balances_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_total_balances_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1440
 *         check_types([inp], [list], ['total_balances setter'], self._c_ignore_type_checking)
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, float],             # <<<<<<<<<<<<<<
 *                     ['time step list of total_balances setter',
 *                      'float value in time step list of total_balances setter'],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __pyx_t_9 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyList_Type)));
  __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
  PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyFloat_Type)));

  /* "trapeza/strategy/fx_strategy.pyx":1441
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, float],
 *                     ['time step list of total_balances setter',             # <<<<<<<<<<<<<<
 *                      'float value in time step list of total_balances setter'],
 *                     self._c_ignore_type_checking)
 */
  __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_kp_u_time_step_list_of_total_balances);
  __Pyx_GIVEREF(__pyx_kp_u_time_step_list_of_total_balances);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_time_step_list_of_total_balances);
  __Pyx_INCREF(__pyx_kp_u_float_value_in_time_step_list_of);
  __Pyx_GIVEREF(__pyx_kp_u_float_value_in_time_step_list_of);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_kp_u_float_value_in_time_step_list_of);

  /* "trapeza/strategy/fx_strategy.pyx":1443
 *                     ['time step list of total_balances setter',
 *                      'float value in time step list of total_balances setter'],
 *                     self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_4);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1444
 *                      'float value in time step list of total_balances setter'],
 *                     self._c_ignore_type_checking)
 *         self.total_balances_from_py(inp)             # <<<<<<<<<<<<<<
 *     @total_balances.deleter
 *     def total_balances(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_total_balances_from_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1431
 *         return ProtectedList(self.self_parse_total_balances())
 *     @total_balances.setter
 *     def total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of total_balances to self.total_balances. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1446
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.total_balances
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_77total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_77total_balances = {"total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_77total_balances, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_77total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_76total_balances(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_76total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1447
 *     @total_balances.deleter
 *     def total_balances(self):
 *         del self.total_balances             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_total_balances) < 0) __PYX_ERR(0, 1447, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1446
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.total_balances
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1450
 * 
 *     @property
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.merged_total_balances. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_79merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_78merged_total_balances[] = "\n        Returns list of self.merged_total_balances. See docstring of FXStrategy class for further information.\n        :return: ProtectedList, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_79merged_total_balances = {"merged_total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_79merged_total_balances, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_78merged_total_balances};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_79merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_78merged_total_balances(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_78merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1455
 *         :return: ProtectedList, immutable
 *         """
 *         return ProtectedList(self.self_parse_merged_total_balances())             # <<<<<<<<<<<<<<
 *     @merged_total_balances.setter
 *     def merged_total_balances(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_merged_total_balances); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1450
 * 
 *     @property
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.merged_total_balances. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1457
 *         return ProtectedList(self.self_parse_merged_total_balances())
 *     @merged_total_balances.setter
 *     def merged_total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of merged_total_balances to self.merged_total_balances. See docstring of FXStrategy class for
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_81merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_80merged_total_balances[] = "\n        Set new list of merged_total_balances to self.merged_total_balances. See docstring of FXStrategy class for\n        further information.\n        :param inp: list of floats, merged_total_balances over all accounts at each time step\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_81merged_total_balances = {"merged_total_balances", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_81merged_total_balances, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_80merged_total_balances};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_81merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_total_balances (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merged_total_balances", 1, 2, 2, 1); __PYX_ERR(0, 1457, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merged_total_balances") < 0)) __PYX_ERR(0, 1457, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merged_total_balances", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1457, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_80merged_total_balances(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_80merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1464
 *         :return: None
 *         """
 *         check_types([inp], [list], ['merged_total_balances setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         # sample check
 *         check_types([inp[0]], [float], ['float value in list of merged_total_balances setter'],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_merged_total_balances_setter);
  __Pyx_GIVEREF(__pyx_kp_u_merged_total_balances_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_merged_total_balances_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1466
 *         check_types([inp], [list], ['merged_total_balances setter'], self._c_ignore_type_checking)
 *         # sample check
 *         check_types([inp[0]], [float], ['float value in list of merged_total_balances setter'],             # <<<<<<<<<<<<<<
 *                     self._c_ignore_type_checking)
 *         self.merged_total_balances_from_py(inp)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
  PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)(&PyFloat_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_float_value_in_list_of_merged_to);
  __Pyx_GIVEREF(__pyx_kp_u_float_value_in_list_of_merged_to);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_float_value_in_list_of_merged_to);

  /* "trapeza/strategy/fx_strategy.pyx":1467
 *         # sample check
 *         check_types([inp[0]], [float], ['float value in list of merged_total_balances setter'],
 *                     self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_9, __pyx_t_5, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_9, __pyx_t_5, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_4);
    __pyx_t_6 = 0;
    __pyx_t_9 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1468
 *         check_types([inp[0]], [float], ['float value in list of merged_total_balances setter'],
 *                     self._c_ignore_type_checking)
 *         self.merged_total_balances_from_py(inp)             # <<<<<<<<<<<<<<
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_merged_total_balances_from_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1457
 *         return ProtectedList(self.self_parse_merged_total_balances())
 *     @merged_total_balances.setter
 *     def merged_total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of merged_total_balances to self.merged_total_balances. See docstring of FXStrategy class for
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1470
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.merged_total_balances
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_83merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_83merged_total_balances = {"merged_total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_83merged_total_balances, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_83merged_total_balances(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merged_total_balances (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_82merged_total_balances(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_82merged_total_balances(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("merged_total_balances", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1471
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):
 *         del self.merged_total_balances             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_merged_total_balances) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1470
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.merged_total_balances
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.merged_total_balances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1474
 * 
 *     @property
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.signals. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_85signals(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_84signals[] = "\n        Returns list of self.signals. See docstring of FXStrategy class for further information.\n        :return: ProtectedList, immutable\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_85signals = {"signals", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_85signals, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_84signals};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_85signals(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("signals (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_84signals(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_84signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signals", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1479
 *         :return: ProtectedList, immutable
 *         """
 *         return ProtectedList(self.self_parse_signals())             # <<<<<<<<<<<<<<
 *     @signals.setter
 *     def signals(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_signals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1474
 * 
 *     @property
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.signals. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1481
 *         return ProtectedList(self.self_parse_signals())
 *     @signals.setter
 *     def signals(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of signals to self.signals. See docstring of FXStrategy class for further information.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_87signals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_86signals[] = "\n        Set new list of signals to self.signals. See docstring of FXStrategy class for further information.\n        :param inp: list of list of list of strings, list for each time step of lists of emitted signals for\n                    each account.\n                    See docstring of FXStrategy class for further information.\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_87signals = {"signals", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_87signals, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_86signals};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_87signals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("signals (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("signals", 1, 2, 2, 1); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "signals") < 0)) __PYX_ERR(0, 1481, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("signals", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1481, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_86signals(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_86signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signals", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1489
 *         :return: None
 *         """
 *         check_types([inp], [list], ['signals setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, list],
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_signals_setter);
  __Pyx_GIVEREF(__pyx_kp_u_signals_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_signals_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1491
 *         check_types([inp], [list], ['signals setter'], self._c_ignore_type_checking)
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, list],             # <<<<<<<<<<<<<<
 *                     ['time step list of signals setter', 'account list in time step list of signals setter'],
 *                     self._c_ignore_type_checking)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __pyx_t_9 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyList_Type)));
  __Pyx_INCREF(((PyObject *)(&PyList_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
  PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyList_Type)));

  /* "trapeza/strategy/fx_strategy.pyx":1492
 *         # sample checks
 *         check_types([inp[0], inp[0][0]], [list, list],
 *                     ['time step list of signals setter', 'account list in time step list of signals setter'],             # <<<<<<<<<<<<<<
 *                     self._c_ignore_type_checking)
 *         if len(inp[0][0]) > 0:
 */
  __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_kp_u_time_step_list_of_signals_setter);
  __Pyx_GIVEREF(__pyx_kp_u_time_step_list_of_signals_setter);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_time_step_list_of_signals_setter);
  __Pyx_INCREF(__pyx_kp_u_account_list_in_time_step_list_o);
  __Pyx_GIVEREF(__pyx_kp_u_account_list_in_time_step_list_o);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_kp_u_account_list_in_time_step_list_o);

  /* "trapeza/strategy/fx_strategy.pyx":1493
 *         check_types([inp[0], inp[0][0]], [list, list],
 *                     ['time step list of signals setter', 'account list in time step list of signals setter'],
 *                     self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if len(inp[0][0]) > 0:
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_4);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1494
 *                     ['time step list of signals setter', 'account list in time step list of signals setter'],
 *                     self._c_ignore_type_checking)
 *         if len(inp[0][0]) > 0:             # <<<<<<<<<<<<<<
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)
 *         self.signals_from_py(inp)
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1494, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = ((__pyx_t_10 > 0) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1495
 *                     self._c_ignore_type_checking)
 *         if len(inp[0][0]) > 0:
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         self.signals_from_py(inp)
 *     @signals.deleter
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_inp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
    PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type)));
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_kp_u_signal_of_account_in_signals_set);
    __Pyx_GIVEREF(__pyx_kp_u_signal_of_account_in_signals_set);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_signal_of_account_in_signals_set);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_4, __pyx_t_7, __pyx_t_9, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_4, __pyx_t_7, __pyx_t_9, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_8, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_7 = 0;
      __pyx_t_9 = 0;
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1494
 *                     ['time step list of signals setter', 'account list in time step list of signals setter'],
 *                     self._c_ignore_type_checking)
 *         if len(inp[0][0]) > 0:             # <<<<<<<<<<<<<<
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)
 *         self.signals_from_py(inp)
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1496
 *         if len(inp[0][0]) > 0:
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)
 *         self.signals_from_py(inp)             # <<<<<<<<<<<<<<
 *     @signals.deleter
 *     def signals(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_signals_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1481
 *         return ProtectedList(self.self_parse_signals())
 *     @signals.setter
 *     def signals(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of signals to self.signals. See docstring of FXStrategy class for further information.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1498
 *         self.signals_from_py(inp)
 *     @signals.deleter
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         del self.signals
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_89signals(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_89signals = {"signals", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_89signals, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_89signals(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("signals (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_88signals(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_88signals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signals", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1499
 *     @signals.deleter
 *     def signals(self):
 *         del self.signals             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_signals) < 0) __PYX_ERR(0, 1499, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1498
 *         self.signals_from_py(inp)
 *     @signals.deleter
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         del self.signals
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.signals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1502
 * 
 *     @property
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self._signals_at_step_t.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_91_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_90_signals_at_step_t[] = "\n        Returns dict of self._signals_at_step_t.\n        This as an intermediate and temporary container, which stores signals emitted at the current time step.\n        :return: ProtectedDict, immutable,\n                 keys: int, index position of account in self.accounts\n                 value: list of strings representing signals emitted by account i at current time step\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_91_signals_at_step_t = {"_signals_at_step_t", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_91_signals_at_step_t, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_90_signals_at_step_t};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_91_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_signals_at_step_t (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_90_signals_at_step_t(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_90_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signals_at_step_t", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1511
 *         """
 *         # readonly access (cython extension type)
 *         return ProtectedDict(self.self_parse_signals_at_step_t())             # <<<<<<<<<<<<<<
 *     @_signals_at_step_t.setter
 *     def _signals_at_step_t(self, inp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_self_parse_signals_at_step_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1502
 * 
 *     @property
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self._signals_at_step_t.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1513
 *         return ProtectedDict(self.self_parse_signals_at_step_t())
 *     @_signals_at_step_t.setter
 *     def _signals_at_step_t(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Sets new dict of _signals_at_step_t to self._signals_at_step_t.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_93_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_92_signals_at_step_t[] = "\n        Sets new dict of _signals_at_step_t to self._signals_at_step_t.\n        This as an intermediate and temporary container, which stores signals emitted at the current time step.\n        :param inp: dict,\n                    keys: int, index position of account in self.accounts\n                    value: list of strings representing signals emitted by account i at current time step\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_93_signals_at_step_t = {"_signals_at_step_t", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_93_signals_at_step_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_92_signals_at_step_t};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_93_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_inp = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_signals_at_step_t (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_inp,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_signals_at_step_t", 1, 2, 2, 1); __PYX_ERR(0, 1513, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_signals_at_step_t") < 0)) __PYX_ERR(0, 1513, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_inp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_signals_at_step_t", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1513, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_92_signals_at_step_t(__pyx_self, __pyx_v_self, __pyx_v_inp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_92_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signals_at_step_t", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1522
 *         :return: None
 *         """
 *         check_types([inp], [dict], ['_signals_at_step_t setter'],  self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         # sample check
 *         if len(inp) > 0:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_inp);
  __Pyx_GIVEREF(__pyx_v_inp);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyDict_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_signals_at_step_t_setter);
  __Pyx_GIVEREF(__pyx_kp_u_signals_at_step_t_setter);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_signals_at_step_t_setter);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1524
 *         check_types([inp], [dict], ['_signals_at_step_t setter'],  self._c_ignore_type_checking)
 *         # sample check
 *         if len(inp) > 0:             # <<<<<<<<<<<<<<
 *             check_types([list(inp.keys())[0]], [int], ['key in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 */
  __pyx_t_10 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1524, __pyx_L1_error)
  __pyx_t_11 = ((__pyx_t_10 > 0) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1525
 *         # sample check
 *         if len(inp) > 0:
 *             check_types([list(inp.keys())[0]], [int], ['key in _signals_at_step_t setter dict'],             # <<<<<<<<<<<<<<
 *                         self._c_ignore_type_checking)
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_inp, __pyx_n_s_keys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_9 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
    PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)(&PyInt_Type)));
    __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_u_key_in__signals_at_step_t_setter);
    __Pyx_GIVEREF(__pyx_kp_u_key_in__signals_at_step_t_setter);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_key_in__signals_at_step_t_setter);

    /* "trapeza/strategy/fx_strategy.pyx":1526
 *         if len(inp) > 0:
 *             check_types([list(inp.keys())[0]], [int], ['key in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_9, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_9, __pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_t_4);
      __pyx_t_6 = 0;
      __pyx_t_9 = 0;
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1527
 *             check_types([list(inp.keys())[0]], [int], ['key in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],             # <<<<<<<<<<<<<<
 *                         self._c_ignore_type_checking)
 *         if len(inp[list(inp.keys())[0]]) > 0:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_inp, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_inp, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)(&PyList_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
    PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyList_Type)));
    __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_u_list_as_value_in__signals_at_ste);
    __Pyx_GIVEREF(__pyx_kp_u_list_as_value_in__signals_at_ste);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_list_as_value_in__signals_at_ste);

    /* "trapeza/strategy/fx_strategy.pyx":1528
 *                         self._c_ignore_type_checking)
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         if len(inp[list(inp.keys())[0]]) > 0:
 *             check_types([inp[list(inp.keys())[0]][0]], [str],
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1524
 *         check_types([inp], [dict], ['_signals_at_step_t setter'],  self._c_ignore_type_checking)
 *         # sample check
 *         if len(inp) > 0:             # <<<<<<<<<<<<<<
 *             check_types([list(inp.keys())[0]], [int], ['key in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1529
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 *         if len(inp[list(inp.keys())[0]]) > 0:             # <<<<<<<<<<<<<<
 *             check_types([inp[list(inp.keys())[0]][0]], [str],
 *                         ['value in list as value in _signals_at_step_t setter dict'], self._c_ignore_type_checking)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_inp, __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_inp, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = ((__pyx_t_10 > 0) != 0);
  if (__pyx_t_11) {

    /* "trapeza/strategy/fx_strategy.pyx":1530
 *                         self._c_ignore_type_checking)
 *         if len(inp[list(inp.keys())[0]]) > 0:
 *             check_types([inp[list(inp.keys())[0]][0]], [str],             # <<<<<<<<<<<<<<
 *                         ['value in list as value in _signals_at_step_t setter dict'], self._c_ignore_type_checking)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_inp, __pyx_n_s_keys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_inp, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
    PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type)));

    /* "trapeza/strategy/fx_strategy.pyx":1531
 *         if len(inp[list(inp.keys())[0]]) > 0:
 *             check_types([inp[list(inp.keys())[0]][0]], [str],
 *                         ['value in list as value in _signals_at_step_t setter dict'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 * 
 *         self._signals_at_step_t_from_py(inp)
 */
    __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_u_value_in_list_as_value_in__signa);
    __Pyx_GIVEREF(__pyx_kp_u_value_in_list_as_value_in__signa);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_value_in_list_as_value_in__signa);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_3, __pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_9, __pyx_t_3, __pyx_t_5, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_8, __pyx_t_4);
      __pyx_t_9 = 0;
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1529
 *             check_types([inp[list(inp.keys())[0]]], [list], ['list as value in _signals_at_step_t setter dict'],
 *                         self._c_ignore_type_checking)
 *         if len(inp[list(inp.keys())[0]]) > 0:             # <<<<<<<<<<<<<<
 *             check_types([inp[list(inp.keys())[0]][0]], [str],
 *                         ['value in list as value in _signals_at_step_t setter dict'], self._c_ignore_type_checking)
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":1533
 *                         ['value in list as value in _signals_at_step_t setter dict'], self._c_ignore_type_checking)
 * 
 *         self._signals_at_step_t_from_py(inp)             # <<<<<<<<<<<<<<
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_signals_at_step_t_from_py); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_inp) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_inp);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1513
 *         return ProtectedDict(self.self_parse_signals_at_step_t())
 *     @_signals_at_step_t.setter
 *     def _signals_at_step_t(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Sets new dict of _signals_at_step_t to self._signals_at_step_t.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1535
 *         self._signals_at_step_t_from_py(inp)
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         del self._signals_at_step_t
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_95_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_95_signals_at_step_t = {"_signals_at_step_t", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_95_signals_at_step_t, METH_O, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_95_signals_at_step_t(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_signals_at_step_t (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_94_signals_at_step_t(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_94_signals_at_step_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signals_at_step_t", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1536
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):
 *         del self._signals_at_step_t             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_signals_at_step_t) < 0) __PYX_ERR(0, 1536, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1535
 *         self._signals_at_step_t_from_py(inp)
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         del self._signals_at_step_t
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._signals_at_step_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1539
 * 
 *     @property
 *     def _ignore_type_checking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns current status whether types are checked (=False) at every method call or if checks are ignored (=True).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_97_ignore_type_checking(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_96_ignore_type_checking[] = "\n        Returns current status whether types are checked (=False) at every method call or if checks are ignored (=True).\n        See docstring of FXStrategy class for further information.\n        :return: bool\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_97_ignore_type_checking = {"_ignore_type_checking", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_97_ignore_type_checking, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_96_ignore_type_checking};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_97_ignore_type_checking(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ignore_type_checking (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_96_ignore_type_checking(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_96_ignore_type_checking(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ignore_type_checking", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1546
 *         """
 *         # readonly access (cython extension type)
 *         return self._c_ignore_type_checking             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1539
 * 
 *     @property
 *     def _ignore_type_checking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns current status whether types are checked (=False) at every method call or if checks are ignored (=True).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._ignore_type_checking", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1549
 * 
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,             # <<<<<<<<<<<<<<
 *                  ignore_type_checking=False, **kwargs):
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_99__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_98__init__[] = "\n        Initializes FXStrategy class object to tie strategy decision function and accounts to one logical unit, which\n        then can be passed to backtest analysis engine. Make sure to use this class object within strategy decision\n        function to add signals (e.g. fxstrat.add_signal called inside externally defined strategy decision function).\n\n        FXStrategy object shall also be used within strategy_func for adding signals.\n\n        FXStrategy.run() handles ticking and parses output in the appropriate format for subsequent analysis during call\n        within FXStrategy.run(). Internal reset is done BEFORE each run, but not after!\n\n        !!! kwargs of tick_func and kwargs of strategy_func must not share same argument names (name conflict) !!!\n\n        :type name: str\n        :param name: str,\n                     name of this strategy & accounts combination, unique name used for visualization and identification\n                     purposes\n        :param accounts: list of FXAccounts (or other objects derived from BaseAccount) or\n                         single FXAccount (or other object derived from BaseAccount)\n        :param strategy_func: function with call signature:\n                                  strategy_func(accounts, price_data_point, reference_currency, volume_data_point,\n                                                fxstrategy, **strategy_kwargs)\n\n                                  accounts: list of account objects (inherited from BaseAccount)\n                                  price_data_point: dict with key:tuple(str, str) and value:float\n                                                    or value:list of floats or value:array of floats\n                                                    dictionary of base and quote currency pair and their respective\n                                                    exchange rate in FX Notation base|quote\n                                                    {(base, quote): [""current_rate],\n                                                     (base, quote): [current_rate],\n                                                      ...}\n                                                     or\n                                                    {(base, quote): [rate_-2, rate_-1, current_rate],\n                                                     (base, quote): [rate_-2, rate_-1, current_rate],\n                                                     ...}\n                                                    --> dependent on size of parameter lookback (whether to prepend\n                                                        historic data to each call to strategy decision function for\n                                                        each loop within FXStrategy.run())\n                                                    If floats or list or array of floats are used as dict values is\n                                                    dependent on the parameter lookback.\n                                  reference_currency: str,\n                                                      reference currency in which results shall be quoted\n                                  volume_data_point: None or dict,\n                                                     if dict, then in the same format as price_data_point (e.g. with\n                                                     volume data instead of exchange rate data)\n                                  fxstrategy: initiated FXStrategy class object used for adding signals within\n                                              strategy_func via fxstrategy.add_signal(signal_str)\n                                  strategy_kwargs: dict,\n                                                   additional custom key word arguments.\n                                                   kwargs of strategy_func can be passed to param:kwargs. Must be\n                                                   containe""d with identical names in param:kwargs, which are passed to\n                                                   FXStrategy.__init__(), see param:kwargs.\n                                                   Similar names to kwargs of tick_func are not allowed.\n\n                            Ticking can either be done within strategy_func or otherwise is done in self.run()\n                            (auto-detection, also refer to param:suppress_ticking; auto-detection if accounts have\n                            been patched by trapeza.account.order_management.monkey_patch()).\n                            Strategy_func does not have to return any values, values are fetched by\n                            FXStrategy.evaluate(). Just make sure, ticking of accounts happens before\n                            FXStrategy.evaluate() such that effect of transactions on accounts has taken place\n\n                            Regarding the strategy decision function parameter 'accounts', a list of accounts is always\n                            passed to strategy decision function during self.run(). Even if a single account is passed\n                            to FXStrategy.__init__, strategy decision function will receive a list of account(s),\n                            e.g. in this case [acc_0] if FXStrategy('genesis', acc_0, awesome_strategy, lookback=42).\n        :param lookback: int,\n                         number of time steps which are treated as historic data when data is supplied to self.run().\n                         Historic data has to be prepended to data manually. Start time step is located at\n                         index=lookback (zero-based indexing). See docstring of class.\n        :param tick_func: func, default=None\n                          custom function for ticking accounts.\n\n                          Default=None, which means internal default function is applied: account.tick() or\n                          account.tick(data) of FXAcco""unt (handles both cases automatically, cf. patch by\n                          trapeza.account.order_management.monkey_patch()).\n\n                          Ignored if param:suppress_ticking is set to True.\n\n                          Must have following call signature:\n                            tick_func(self, data_point, **kwargs)\n\n                            self: placeholder in function signature to access self of this class\n                            data_point: same as price_data_point in param:strategy_func\n                                        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                                        Make sure custom tick_func accepts this data format\n                                        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                            kwargs: additionally kwargs arguments,\n                                    kwargs of tick_func can be passed to param:kwargs. Must be contained with identical\n                                    names in param:kwargs, which are passed to FXStrategy.__init__(), see param:kwargs.\n                                    Similar names to kwargs of strategy_func are not allowed.\n\n                          Volume data is not needed within ticking. Sell and buy volumes are set by account.sell() and\n                          account.buy(). To calculate order size, only price data is needed. Therefore tick_func does\n                          not need to be supplied with (market/ trading) volume data.\n        :param suppress_ticking: bool, default=False,\n                                 if set to True, ticking of accounts (internal time-state machine) is ignored (at least\n                                 self.run() does not try to tick accounts, accounts still can be ticked from inside\n                                 param:strategy_func),\n                                 if set to False, accounts will be ticked according to param:tick_func\n     ""   :param kwargs: additional key word arguments,\n                       kwargs can be supplied for param:tick_func (if function is passed as argument to\n                       FXStrategy.__init__() method, respectively param:tick_func is not None) and for\n                       param:strategy_func all in one.\n                       Auto-splits kwargs into kwargs of param:tick_func and param:strategy_func as long as both do\n                       not use same argument names!\n        :param ignore_type_checking: bool,\n                                     if True, type checking is omitted, which increases performance but is less safe\n        :return: None\n        :raises: trapeza.OperatingError: if kwargs of strategy_func and tick_func have identically named arguments\n                 TypeError: if types do not match up,\n                            only thrown if ignore_type_checking is False (type_checking enabled at __init__)\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_99__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_99__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_98__init__};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_99__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_accounts = 0;
  PyObject *__pyx_v_strategy_func = 0;
  long __pyx_v_lookback;
  PyObject *__pyx_v_tick_func = 0;
  PyObject *__pyx_v_suppress_ticking = 0;
  PyObject *__pyx_v_ignore_type_checking = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_accounts,&__pyx_n_s_strategy_func,&__pyx_n_s_lookback,&__pyx_n_s_tick_func,&__pyx_n_s_suppress_ticking,&__pyx_n_s_ignore_type_checking,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_False));

    /* "trapeza/strategy/fx_strategy.pyx":1550
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,
 *                  ignore_type_checking=False, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes FXStrategy class object to tie strategy decision function and accounts to one logical unit, which
 */
    values[7] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 1); __PYX_ERR(0, 1549, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_accounts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 2); __PYX_ERR(0, 1549, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strategy_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 3); __PYX_ERR(0, 1549, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lookback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 4); __PYX_ERR(0, 1549, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_func);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_suppress_ticking);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_type_checking);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1549, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_name = ((PyObject*)values[1]);
    __pyx_v_accounts = values[2];
    __pyx_v_strategy_func = values[3];
    __pyx_v_lookback = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_lookback == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error)
    __pyx_v_tick_func = values[5];
    __pyx_v_suppress_ticking = values[6];
    __pyx_v_ignore_type_checking = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1549, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 1549, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_98__init__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_v_lookback, __pyx_v_tick_func, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_kwargs);

  /* "trapeza/strategy/fx_strategy.pyx":1549
 * 
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,             # <<<<<<<<<<<<<<
 *                  ignore_type_checking=False, **kwargs):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_98__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_accounts, PyObject *__pyx_v_strategy_func, long __pyx_v_lookback, PyObject *__pyx_v_tick_func, PyObject *__pyx_v_suppress_ticking, PyObject *__pyx_v_ignore_type_checking, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_tick_method = NULL;
  PyObject *__pyx_v_strategy_kwargs = NULL;
  PyObject *__pyx_v_tick_kwargs = NULL;
  PyObject *__pyx_v_strategy_param_names = NULL;
  PyObject *__pyx_v_tick_param_names = NULL;
  PyObject *__pyx_v_intersection_param_names = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_k = NULL;
  CYTHON_UNUSED PyObject *__pyx_9genexpr22__pyx_v__ = NULL;
  PyObject *__pyx_9genexpr23__pyx_v_k = NULL;
  CYTHON_UNUSED PyObject *__pyx_9genexpr23__pyx_v__ = NULL;
  PyObject *__pyx_9genexpr24__pyx_v_k = NULL;
  CYTHON_UNUSED PyObject *__pyx_9genexpr24__pyx_v__ = NULL;
  PyObject *__pyx_9genexpr25__pyx_v_k = NULL;
  CYTHON_UNUSED PyObject *__pyx_9genexpr25__pyx_v__ = NULL;
  PyObject *__pyx_9genexpr26__pyx_v_k = NULL;
  PyObject *__pyx_9genexpr27__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_accounts);

  /* "trapeza/strategy/fx_strategy.pyx":1662
 *                             only thrown if ignore_type_checking is False (type_checking enabled at __init__)
 *         """
 *         check_types([name], [str], ['name'], ignore_type_checking)             # <<<<<<<<<<<<<<
 *         # >>>check if account inherits from trapeza.account.base_account.BaseAccount and assign to self.accounts
 *         accounts = self._check_parse_accounts(accounts)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_name);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_n_u_name);
  __Pyx_GIVEREF(__pyx_n_u_name);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_name);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_ignore_type_checking};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_ignore_type_checking};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_ignore_type_checking);
    __Pyx_GIVEREF(__pyx_v_ignore_type_checking);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_ignore_type_checking);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1664
 *         check_types([name], [str], ['name'], ignore_type_checking)
 *         # >>>check if account inherits from trapeza.account.base_account.BaseAccount and assign to self.accounts
 *         accounts = self._check_parse_accounts(accounts)             # <<<<<<<<<<<<<<
 * 
 *         # >>>check types and store attributes
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check_parse_accounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_v_accounts) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_accounts);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_accounts, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1667
 * 
 *         # >>>check types and store attributes
 *         check_types([strategy_func, kwargs, lookback, suppress_ticking],             # <<<<<<<<<<<<<<
 *                     [callable, dict, int, bool],
 *                     ['strategy_func', '**kwargs', 'lookback', 'suppress_ticking'], ignore_type_checking)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_lookback); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = PyList_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_strategy_func);
  __Pyx_GIVEREF(__pyx_v_strategy_func);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_strategy_func);
  __Pyx_INCREF(__pyx_v_kwargs);
  __Pyx_GIVEREF(__pyx_v_kwargs);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_kwargs);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_suppress_ticking);
  __Pyx_GIVEREF(__pyx_v_suppress_ticking);
  PyList_SET_ITEM(__pyx_t_5, 3, __pyx_v_suppress_ticking);
  __pyx_t_8 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1668
 *         # >>>check types and store attributes
 *         check_types([strategy_func, kwargs, lookback, suppress_ticking],
 *                     [callable, dict, int, bool],             # <<<<<<<<<<<<<<
 *                     ['strategy_func', '**kwargs', 'lookback', 'suppress_ticking'], ignore_type_checking)
 * 
 */
  __pyx_t_8 = __Pyx_GetBuiltinName(__pyx_n_s_callable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyList_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
  __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
  PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)(&PyDict_Type)));
  __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
  PyList_SET_ITEM(__pyx_t_4, 2, ((PyObject *)(&PyInt_Type)));
  __Pyx_INCREF(((PyObject*)&PyBool_Type));
  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
  PyList_SET_ITEM(__pyx_t_4, 3, ((PyObject*)&PyBool_Type));
  __pyx_t_8 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1669
 *         check_types([strategy_func, kwargs, lookback, suppress_ticking],
 *                     [callable, dict, int, bool],
 *                     ['strategy_func', '**kwargs', 'lookback', 'suppress_ticking'], ignore_type_checking)             # <<<<<<<<<<<<<<
 * 
 *         if tick_func is None:
 */
  __pyx_t_8 = PyList_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_n_u_strategy_func);
  __Pyx_GIVEREF(__pyx_n_u_strategy_func);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_strategy_func);
  __Pyx_INCREF(__pyx_kp_u_kwargs);
  __Pyx_GIVEREF(__pyx_kp_u_kwargs);
  PyList_SET_ITEM(__pyx_t_8, 1, __pyx_kp_u_kwargs);
  __Pyx_INCREF(__pyx_n_u_lookback);
  __Pyx_GIVEREF(__pyx_n_u_lookback);
  PyList_SET_ITEM(__pyx_t_8, 2, __pyx_n_u_lookback);
  __Pyx_INCREF(__pyx_n_u_suppress_ticking);
  __Pyx_GIVEREF(__pyx_n_u_suppress_ticking);
  PyList_SET_ITEM(__pyx_t_8, 3, __pyx_n_u_suppress_ticking);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_8, __pyx_v_ignore_type_checking};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_t_5, __pyx_t_4, __pyx_t_8, __pyx_v_ignore_type_checking};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_ignore_type_checking);
    __Pyx_GIVEREF(__pyx_v_ignore_type_checking);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_ignore_type_checking);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1671
 *                     ['strategy_func', '**kwargs', 'lookback', 'suppress_ticking'], ignore_type_checking)
 * 
 *         if tick_func is None:             # <<<<<<<<<<<<<<
 *             tick_method = _c_tick_method
 *         else:
 */
  __pyx_t_9 = (__pyx_v_tick_func == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "trapeza/strategy/fx_strategy.pyx":1672
 * 
 *         if tick_func is None:
 *             tick_method = _c_tick_method             # <<<<<<<<<<<<<<
 *         else:
 *             tick_method = tick_func
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_c_tick_method_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_tick_method = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1671
 *                     ['strategy_func', '**kwargs', 'lookback', 'suppress_ticking'], ignore_type_checking)
 * 
 *         if tick_func is None:             # <<<<<<<<<<<<<<
 *             tick_method = _c_tick_method
 *         else:
 */
    goto __pyx_L3;
  }

  /* "trapeza/strategy/fx_strategy.pyx":1674
 *             tick_method = _c_tick_method
 *         else:
 *             tick_method = tick_func             # <<<<<<<<<<<<<<
 * 
 *         # >>>split kwargs into strategy_func and tick_func
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_tick_func);
    __pyx_v_tick_method = __pyx_v_tick_func;
  }
  __pyx_L3:;

  /* "trapeza/strategy/fx_strategy.pyx":1677
 * 
 *         # >>>split kwargs into strategy_func and tick_func
 *         if tick_func is None:             # <<<<<<<<<<<<<<
 *             strategy_kwargs = kwargs
 *             tick_kwargs = dict()
 */
  __pyx_t_10 = (__pyx_v_tick_func == Py_None);
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "trapeza/strategy/fx_strategy.pyx":1678
 *         # >>>split kwargs into strategy_func and tick_func
 *         if tick_func is None:
 *             strategy_kwargs = kwargs             # <<<<<<<<<<<<<<
 *             tick_kwargs = dict()
 *         else:
 */
    __Pyx_INCREF(__pyx_v_kwargs);
    __pyx_v_strategy_kwargs = __pyx_v_kwargs;

    /* "trapeza/strategy/fx_strategy.pyx":1679
 *         if tick_func is None:
 *             strategy_kwargs = kwargs
 *             tick_kwargs = dict()             # <<<<<<<<<<<<<<
 *         else:
 *             # first check if any of the strategy decision function's and any of the tick function's arguments are named
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_tick_kwargs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1677
 * 
 *         # >>>split kwargs into strategy_func and tick_func
 *         if tick_func is None:             # <<<<<<<<<<<<<<
 *             strategy_kwargs = kwargs
 *             tick_kwargs = dict()
 */
    goto __pyx_L4;
  }

  /* "trapeza/strategy/fx_strategy.pyx":1683
 *             # first check if any of the strategy decision function's and any of the tick function's arguments are named
 *             # the same
 *             strategy_param_names = [k for k, _ in inspect.signature(strategy_func).parameters.items()]             # <<<<<<<<<<<<<<
 *             tick_param_names = [k for k, _ in inspect.signature(tick_func).parameters.items()]
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_inspect); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_signature); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_v_strategy_func) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_strategy_func);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__pyx_t_4 == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 1683, __pyx_L7_error)
      }
      __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_4, 0, __pyx_n_s_items, (&__pyx_t_12), (&__pyx_t_7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1683, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_6;
      __pyx_t_6 = 0;
      while (1) {
        __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_12, &__pyx_t_11, &__pyx_t_6, &__pyx_t_4, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_13 == 0)) break;
        if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1683, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_k, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v__, __pyx_t_4);
        __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr22__pyx_v_k))) __PYX_ERR(0, 1683, __pyx_L7_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v__); __pyx_9genexpr22__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_k); __pyx_9genexpr22__pyx_v_k = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v__); __pyx_9genexpr22__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_k); __pyx_9genexpr22__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __pyx_v_strategy_param_names = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1684
 *             # the same
 *             strategy_param_names = [k for k, _ in inspect.signature(strategy_func).parameters.items()]
 *             tick_param_names = [k for k, _ in inspect.signature(tick_func).parameters.items()]             # <<<<<<<<<<<<<<
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))
 *             if len(intersection_param_names):
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_inspect); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_signature); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_tick_func) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_tick_func);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_parameters); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__pyx_t_8 == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 1684, __pyx_L13_error)
      }
      __pyx_t_4 = __Pyx_dict_iterator(__pyx_t_8, 0, __pyx_n_s_items, (&__pyx_t_11), (&__pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1684, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      while (1) {
        __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_11, &__pyx_t_12, &__pyx_t_4, &__pyx_t_8, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_13 == 0)) break;
        if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1684, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr23__pyx_v_k, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr23__pyx_v__, __pyx_t_8);
        __pyx_t_8 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr23__pyx_v_k))) __PYX_ERR(0, 1684, __pyx_L13_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v__); __pyx_9genexpr23__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_k); __pyx_9genexpr23__pyx_v_k = 0;
      goto __pyx_L16_exit_scope;
      __pyx_L13_error:;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v__); __pyx_9genexpr23__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_k); __pyx_9genexpr23__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L16_exit_scope:;
    } /* exit inner scope */
    __pyx_v_tick_param_names = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1685
 *             strategy_param_names = [k for k, _ in inspect.signature(strategy_func).parameters.items()]
 *             tick_param_names = [k for k, _ in inspect.signature(tick_func).parameters.items()]
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))             # <<<<<<<<<<<<<<
 *             if len(intersection_param_names):
 *                 raise tpz_exception.OperatingError('param:strategy_func and param:tick_func have identically named'
 */
    __pyx_t_2 = PySet_New(__pyx_v_strategy_param_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_intersection); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PySet_New(__pyx_v_tick_param_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_intersection_param_names = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1686
 *             tick_param_names = [k for k, _ in inspect.signature(tick_func).parameters.items()]
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))
 *             if len(intersection_param_names):             # <<<<<<<<<<<<<<
 *                 raise tpz_exception.OperatingError('param:strategy_func and param:tick_func have identically named'
 *                                                    'parameters/ kwargs, which makes it impossible to evaluate'
 */
    __pyx_t_11 = PyObject_Length(__pyx_v_intersection_param_names); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1686, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_11 != 0);
    if (unlikely(__pyx_t_9)) {

      /* "trapeza/strategy/fx_strategy.pyx":1687
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))
 *             if len(intersection_param_names):
 *                 raise tpz_exception.OperatingError('param:strategy_func and param:tick_func have identically named'             # <<<<<<<<<<<<<<
 *                                                    'parameters/ kwargs, which makes it impossible to evaluate'
 *                                                    'param:**kwargs during class initialization. '
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_tpz_exception); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_OperatingError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1690
 *                                                    'parameters/ kwargs, which makes it impossible to evaluate'
 *                                                    'param:**kwargs during class initialization. '
 *                                                    '\n Identically named params: {}'.format(intersection_param_names))             # <<<<<<<<<<<<<<
 *             # the first five arguments of strategy decision function are positional and therefore irrelevant
 *             # the first two arguments of tick function are positional and therefore irrelevant
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_param_strategy_func_and_param_ti, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_v_intersection_param_names) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_intersection_param_names);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1687, __pyx_L1_error)

      /* "trapeza/strategy/fx_strategy.pyx":1686
 *             tick_param_names = [k for k, _ in inspect.signature(tick_func).parameters.items()]
 *             intersection_param_names = set(strategy_param_names).intersection(set(tick_param_names))
 *             if len(intersection_param_names):             # <<<<<<<<<<<<<<
 *                 raise tpz_exception.OperatingError('param:strategy_func and param:tick_func have identically named'
 *                                                    'parameters/ kwargs, which makes it impossible to evaluate'
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":1695
 *             # positional arguments are passed as positional arguments in the main c_run() function, only the rest is
 *             # passed as kwargs and are therefore relevant in the following
 *             strategy_param_names = [k for k, _ in list(inspect.signature(strategy_func).parameters.items())[5:]]             # <<<<<<<<<<<<<<
 *             tick_param_names = [k for k, _ in list(inspect.signature(tick_func).parameters.items())[2:]]
 *             strategy_kwargs = {k: kwargs[k] for k in kwargs if k in strategy_param_names}
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_inspect); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_signature); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_strategy_func) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_strategy_func);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_parameters); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_items); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_t_8, 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1695, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_t_2; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1695, __pyx_L20_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1695, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
          PyObject* sequence = __pyx_t_2;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1695, __pyx_L20_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          #else
          __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1695, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1695, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1695, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext;
          index = 0; __pyx_t_6 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L23_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          index = 1; __pyx_t_4 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L23_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1695, __pyx_L20_error)
          __pyx_t_14 = NULL;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L24_unpacking_done;
          __pyx_L23_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_14 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 1695, __pyx_L20_error)
          __pyx_L24_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr24__pyx_v_k, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr24__pyx_v__, __pyx_t_4);
        __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr24__pyx_v_k))) __PYX_ERR(0, 1695, __pyx_L20_error)
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_9genexpr24__pyx_v__); __pyx_9genexpr24__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_k); __pyx_9genexpr24__pyx_v_k = 0;
      goto __pyx_L25_exit_scope;
      __pyx_L20_error:;
      __Pyx_XDECREF(__pyx_9genexpr24__pyx_v__); __pyx_9genexpr24__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_k); __pyx_9genexpr24__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L25_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_strategy_param_names, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1696
 *             # passed as kwargs and are therefore relevant in the following
 *             strategy_param_names = [k for k, _ in list(inspect.signature(strategy_func).parameters.items())[5:]]
 *             tick_param_names = [k for k, _ in list(inspect.signature(tick_func).parameters.items())[2:]]             # <<<<<<<<<<<<<<
 *             strategy_kwargs = {k: kwargs[k] for k in kwargs if k in strategy_param_names}
 *             tick_kwargs = {k: kwargs[k] for k in kwargs if k in tick_param_names}
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_inspect); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_signature); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_tick_func) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_tick_func);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_parameters); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyList_GetSlice(__pyx_t_2, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1696, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1696, __pyx_L28_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1696, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
          PyObject* sequence = __pyx_t_8;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1696, __pyx_L28_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          #else
          __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1696, __pyx_L28_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1696, __pyx_L28_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L28_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext;
          index = 0; __pyx_t_6 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L31_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          index = 1; __pyx_t_4 = __pyx_t_14(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L31_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_4);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1696, __pyx_L28_error)
          __pyx_t_14 = NULL;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L32_unpacking_done;
          __pyx_L31_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_14 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 1696, __pyx_L28_error)
          __pyx_L32_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v_k, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v__, __pyx_t_4);
        __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr25__pyx_v_k))) __PYX_ERR(0, 1696, __pyx_L28_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v__); __pyx_9genexpr25__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_k); __pyx_9genexpr25__pyx_v_k = 0;
      goto __pyx_L33_exit_scope;
      __pyx_L28_error:;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v__); __pyx_9genexpr25__pyx_v__ = 0;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_k); __pyx_9genexpr25__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L33_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_tick_param_names, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1697
 *             strategy_param_names = [k for k, _ in list(inspect.signature(strategy_func).parameters.items())[5:]]
 *             tick_param_names = [k for k, _ in list(inspect.signature(tick_func).parameters.items())[2:]]
 *             strategy_kwargs = {k: kwargs[k] for k in kwargs if k in strategy_param_names}             # <<<<<<<<<<<<<<
 *             tick_kwargs = {k: kwargs[k] for k in kwargs if k in tick_param_names}
 * 
 */
    { /* enter inner scope */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1697, __pyx_L36_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = 0;
      __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_12), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1697, __pyx_L36_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
      while (1) {
        __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_12, &__pyx_t_11, &__pyx_t_8, NULL, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_13 == 0)) break;
        if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1697, __pyx_L36_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr26__pyx_v_k, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_9genexpr26__pyx_v_k, __pyx_v_strategy_param_names, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1697, __pyx_L36_error)
        __pyx_t_10 = (__pyx_t_9 != 0);
        if (__pyx_t_10) {
          __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_9genexpr26__pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1697, __pyx_L36_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr26__pyx_v_k, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 1697, __pyx_L36_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_k); __pyx_9genexpr26__pyx_v_k = 0;
      goto __pyx_L40_exit_scope;
      __pyx_L36_error:;
      __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_k); __pyx_9genexpr26__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L40_exit_scope:;
    } /* exit inner scope */
    __pyx_v_strategy_kwargs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1698
 *             tick_param_names = [k for k, _ in list(inspect.signature(tick_func).parameters.items())[2:]]
 *             strategy_kwargs = {k: kwargs[k] for k in kwargs if k in strategy_param_names}
 *             tick_kwargs = {k: kwargs[k] for k in kwargs if k in tick_param_names}             # <<<<<<<<<<<<<<
 * 
 *         # string name, list accounts, object strategy_func, long lookback, object tick_func,
 */
    { /* enter inner scope */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1698, __pyx_L43_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = 0;
      __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_11), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1698, __pyx_L43_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
      while (1) {
        __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_11, &__pyx_t_12, &__pyx_t_8, NULL, NULL, __pyx_t_7);
        if (unlikely(__pyx_t_13 == 0)) break;
        if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1698, __pyx_L43_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr27__pyx_v_k, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_9genexpr27__pyx_v_k, __pyx_v_tick_param_names, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1698, __pyx_L43_error)
        __pyx_t_9 = (__pyx_t_10 != 0);
        if (__pyx_t_9) {
          __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_9genexpr27__pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1698, __pyx_L43_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr27__pyx_v_k, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 1698, __pyx_L43_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_k); __pyx_9genexpr27__pyx_v_k = 0;
      goto __pyx_L47_exit_scope;
      __pyx_L43_error:;
      __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_k); __pyx_9genexpr27__pyx_v_k = 0;
      goto __pyx_L1_error;
      __pyx_L47_exit_scope:;
    } /* exit inner scope */
    __pyx_v_tick_kwargs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "trapeza/strategy/fx_strategy.pyx":1702
 *         # string name, list accounts, object strategy_func, long lookback, object tick_func,
 *         #                  suppress_ticking, ignore_type_checking, dict strategy_kwargs, dict tick_kwargs
 *         super().__init__(name.encode(), accounts, strategy_func, lookback, tick_method, suppress_ticking,             # <<<<<<<<<<<<<<
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 1702, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1702, __pyx_L1_error)
  }
  __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_name, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_lookback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "trapeza/strategy/fx_strategy.pyx":1703
 *         #                  suppress_ticking, ignore_type_checking, dict strategy_kwargs, dict tick_kwargs
 *         super().__init__(name.encode(), accounts, strategy_func, lookback, tick_method, suppress_ticking,
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def _check_parse_accounts(self, accounts):
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_t_2, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_t_4, __pyx_v_tick_method, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1702, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_t_2, __pyx_v_accounts, __pyx_v_strategy_func, __pyx_t_4, __pyx_v_tick_method, __pyx_v_suppress_ticking, __pyx_v_ignore_type_checking, __pyx_v_strategy_kwargs, __pyx_v_tick_kwargs};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1702, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(9+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_accounts);
    __Pyx_GIVEREF(__pyx_v_accounts);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_accounts);
    __Pyx_INCREF(__pyx_v_strategy_func);
    __Pyx_GIVEREF(__pyx_v_strategy_func);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_strategy_func);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_tick_method);
    __Pyx_GIVEREF(__pyx_v_tick_method);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_7, __pyx_v_tick_method);
    __Pyx_INCREF(__pyx_v_suppress_ticking);
    __Pyx_GIVEREF(__pyx_v_suppress_ticking);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_7, __pyx_v_suppress_ticking);
    __Pyx_INCREF(__pyx_v_ignore_type_checking);
    __Pyx_GIVEREF(__pyx_v_ignore_type_checking);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_7, __pyx_v_ignore_type_checking);
    __Pyx_INCREF(__pyx_v_strategy_kwargs);
    __Pyx_GIVEREF(__pyx_v_strategy_kwargs);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_7, __pyx_v_strategy_kwargs);
    __Pyx_INCREF(__pyx_v_tick_kwargs);
    __Pyx_GIVEREF(__pyx_v_tick_kwargs);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_7, __pyx_v_tick_kwargs);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1549
 * 
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,             # <<<<<<<<<<<<<<
 *                  ignore_type_checking=False, **kwargs):
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tick_method);
  __Pyx_XDECREF(__pyx_v_strategy_kwargs);
  __Pyx_XDECREF(__pyx_v_tick_kwargs);
  __Pyx_XDECREF(__pyx_v_strategy_param_names);
  __Pyx_XDECREF(__pyx_v_tick_param_names);
  __Pyx_XDECREF(__pyx_v_intersection_param_names);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v__);
  __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr23__pyx_v__);
  __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr24__pyx_v__);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v__);
  __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_k);
  __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_accounts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1705
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)
 * 
 *     def _check_parse_accounts(self, accounts):             # <<<<<<<<<<<<<<
 *         """
 *         Checks if accounts (or account) are derived from trapeza.account.base_account.BaseAccount and
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_101_check_parse_accounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_100_check_parse_accounts[] = "\n        Checks if accounts (or account) are derived from trapeza.account.base_account.BaseAccount and\n        assigns them internally\n        to self.accounts (or [account])\n\n        :param accounts: list of FXAccount objects\n        :return: None\n        :raises: trapeza.exceptions.AccountError, if accounts not derived from trapeza.account.base_account.BaseAccount\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_101_check_parse_accounts = {"_check_parse_accounts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_101_check_parse_accounts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_100_check_parse_accounts};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_101_check_parse_accounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_accounts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_check_parse_accounts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_accounts,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_accounts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_check_parse_accounts", 1, 2, 2, 1); __PYX_ERR(0, 1705, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_check_parse_accounts") < 0)) __PYX_ERR(0, 1705, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_accounts = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_check_parse_accounts", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1705, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._check_parse_accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_100_check_parse_accounts(__pyx_self, __pyx_v_self, __pyx_v_accounts);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_100_check_parse_accounts(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_accounts) {
  PyObject *__pyx_v_acc = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_parse_accounts", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1715
 *         :raises: trapeza.exceptions.AccountError, if accounts not derived from trapeza.account.base_account.BaseAccount
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "trapeza/strategy/fx_strategy.pyx":1716
 *         """
 *         try:
 *             for acc in accounts:             # <<<<<<<<<<<<<<
 *                 if not issubclass(acc.__class__, BaseAccount):
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '
 */
      if (likely(PyList_CheckExact(__pyx_v_accounts)) || PyTuple_CheckExact(__pyx_v_accounts)) {
        __pyx_t_4 = __pyx_v_accounts; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_accounts); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1716, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1716, __pyx_L3_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1716, __pyx_L3_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1716, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1716, __pyx_L3_error)
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1716, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_7);
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_6(__pyx_t_4);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1716, __pyx_L3_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_acc, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":1717
 *         try:
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):             # <<<<<<<<<<<<<<
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '
 *                                                           'trapeza.account.base_account.BaseAccount.')
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_acc, __pyx_n_s_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_BaseAccount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1717, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PyObject_IsSubclass(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1717, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = ((!(__pyx_t_9 != 0)) != 0);
        if (unlikely(__pyx_t_10)) {

          /* "trapeza/strategy/fx_strategy.pyx":1718
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '             # <<<<<<<<<<<<<<
 *                                                           'trapeza.account.base_account.BaseAccount.')
 *             return accounts
 */
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tpz_exception); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1718, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_AccountError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1718, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = NULL;
          __pyx_t_12 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
              __pyx_t_12 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_acc, __pyx_kp_u_Account_has_to_inherit_from_trap};
            __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1718, __pyx_L3_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_8);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_acc, __pyx_kp_u_Account_has_to_inherit_from_trap};
            __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1718, __pyx_L3_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_8);
          } else
          #endif
          {
            __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1718, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_13);
            if (__pyx_t_7) {
              __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7); __pyx_t_7 = NULL;
            }
            __Pyx_INCREF(__pyx_v_acc);
            __Pyx_GIVEREF(__pyx_v_acc);
            PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_acc);
            __Pyx_INCREF(__pyx_kp_u_Account_has_to_inherit_from_trap);
            __Pyx_GIVEREF(__pyx_kp_u_Account_has_to_inherit_from_trap);
            PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_kp_u_Account_has_to_inherit_from_trap);
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1718, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(0, 1718, __pyx_L3_error)

          /* "trapeza/strategy/fx_strategy.pyx":1717
 *         try:
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):             # <<<<<<<<<<<<<<
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '
 *                                                           'trapeza.account.base_account.BaseAccount.')
 */
        }

        /* "trapeza/strategy/fx_strategy.pyx":1716
 *         """
 *         try:
 *             for acc in accounts:             # <<<<<<<<<<<<<<
 *                 if not issubclass(acc.__class__, BaseAccount):
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1720
 *                     raise tpz_exception.AccountError(acc, 'Account has to inherit from '
 *                                                           'trapeza.account.base_account.BaseAccount.')
 *             return accounts             # <<<<<<<<<<<<<<
 *         except TypeError:
 *             if not issubclass(accounts.__class__, BaseAccount):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_accounts);
      __pyx_r = __pyx_v_accounts;
      goto __pyx_L7_try_return;

      /* "trapeza/strategy/fx_strategy.pyx":1715
 *         :raises: trapeza.exceptions.AccountError, if accounts not derived from trapeza.account.base_account.BaseAccount
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1721
 *                                                           'trapeza.account.base_account.BaseAccount.')
 *             return accounts
 *         except TypeError:             # <<<<<<<<<<<<<<
 *             if not issubclass(accounts.__class__, BaseAccount):
 *                 raise tpz_exception.AccountError(accounts, 'Account has to inherit from '
 */
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._check_parse_accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_11) < 0) __PYX_ERR(0, 1721, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_11);

      /* "trapeza/strategy/fx_strategy.pyx":1722
 *             return accounts
 *         except TypeError:
 *             if not issubclass(accounts.__class__, BaseAccount):             # <<<<<<<<<<<<<<
 *                 raise tpz_exception.AccountError(accounts, 'Account has to inherit from '
 *                                                            'trapeza.account.base_account.BaseAccount.')
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_accounts, __pyx_n_s_class); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1722, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_BaseAccount); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1722, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = PyObject_IsSubclass(__pyx_t_13, __pyx_t_7); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1722, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = ((!(__pyx_t_10 != 0)) != 0);
      if (unlikely(__pyx_t_9)) {

        /* "trapeza/strategy/fx_strategy.pyx":1723
 *         except TypeError:
 *             if not issubclass(accounts.__class__, BaseAccount):
 *                 raise tpz_exception.AccountError(accounts, 'Account has to inherit from '             # <<<<<<<<<<<<<<
 *                                                            'trapeza.account.base_account.BaseAccount.')
 *             return [accounts]
 */
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_tpz_exception); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_AccountError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_accounts, __pyx_kp_u_Account_has_to_inherit_from_trap};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_accounts, __pyx_kp_u_Account_has_to_inherit_from_trap};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (__pyx_t_13) {
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
          }
          __Pyx_INCREF(__pyx_v_accounts);
          __Pyx_GIVEREF(__pyx_v_accounts);
          PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_v_accounts);
          __Pyx_INCREF(__pyx_kp_u_Account_has_to_inherit_from_trap);
          __Pyx_GIVEREF(__pyx_kp_u_Account_has_to_inherit_from_trap);
          PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_kp_u_Account_has_to_inherit_from_trap);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1723, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(0, 1723, __pyx_L5_except_error)

        /* "trapeza/strategy/fx_strategy.pyx":1722
 *             return accounts
 *         except TypeError:
 *             if not issubclass(accounts.__class__, BaseAccount):             # <<<<<<<<<<<<<<
 *                 raise tpz_exception.AccountError(accounts, 'Account has to inherit from '
 *                                                            'trapeza.account.base_account.BaseAccount.')
 */
      }

      /* "trapeza/strategy/fx_strategy.pyx":1725
 *                 raise tpz_exception.AccountError(accounts, 'Account has to inherit from '
 *                                                            'trapeza.account.base_account.BaseAccount.')
 *             return [accounts]             # <<<<<<<<<<<<<<
 *         except tpz_exception.AccountError as e:
 *             # re-raise
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1725, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_accounts);
      __Pyx_GIVEREF(__pyx_v_accounts);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_accounts);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L6_except_return;
    }

    /* "trapeza/strategy/fx_strategy.pyx":1726
 *                                                            'trapeza.account.base_account.BaseAccount.')
 *             return [accounts]
 *         except tpz_exception.AccountError as e:             # <<<<<<<<<<<<<<
 *             # re-raise
 *             raise e
 */
    __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_8, &__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tpz_exception); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1726, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_AccountError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1726, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_11, __pyx_t_14);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_ErrRestore(__pyx_t_11, __pyx_t_8, __pyx_t_4);
    __pyx_t_11 = 0; __pyx_t_8 = 0; __pyx_t_4 = 0;
    if (__pyx_t_12) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._check_parse_accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_11) < 0) __PYX_ERR(0, 1726, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_e = __pyx_t_8;
      /*try:*/ {

        /* "trapeza/strategy/fx_strategy.pyx":1728
 *         except tpz_exception.AccountError as e:
 *             # re-raise
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def _init_all_positions(self, all_keys):
 */
        __Pyx_Raise(__pyx_v_e, 0, 0, 0);
        __PYX_ERR(0, 1728, __pyx_L20_error)
      }

      /* "trapeza/strategy/fx_strategy.pyx":1726
 *                                                            'trapeza.account.base_account.BaseAccount.')
 *             return [accounts]
 *         except tpz_exception.AccountError as e:             # <<<<<<<<<<<<<<
 *             # re-raise
 *             raise e
 */
      /*finally:*/ {
        __pyx_L20_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_23);
          __pyx_t_12 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_e);
            __pyx_v_e = NULL;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          }
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
          __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
          __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
          goto __pyx_L5_except_error;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "trapeza/strategy/fx_strategy.pyx":1715
 *         :raises: trapeza.exceptions.AccountError, if accounts not derived from trapeza.account.base_account.BaseAccount
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             for acc in accounts:
 *                 if not issubclass(acc.__class__, BaseAccount):
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "trapeza/strategy/fx_strategy.pyx":1705
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)
 * 
 *     def _check_parse_accounts(self, accounts):             # <<<<<<<<<<<<<<
 *         """
 *         Checks if accounts (or account) are derived from trapeza.account.base_account.BaseAccount and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._check_parse_accounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_acc);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1730
 *             raise e
 * 
 *     def _init_all_positions(self, all_keys):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes positions (self.depot_position and self.depot_composite_positions)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_103_init_all_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_102_init_all_positions[] = "\n        Initializes positions (self.depot_position and self.depot_composite_positions)\n\n        :param all_keys: list of keys,\n                         all keys (currency pairs) of data supplied to self.run()\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_103_init_all_positions = {"_init_all_positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_103_init_all_positions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_102_init_all_positions};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_103_init_all_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_all_keys = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_all_positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_all_keys,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_all_keys)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_init_all_positions", 1, 2, 2, 1); __PYX_ERR(0, 1730, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_init_all_positions") < 0)) __PYX_ERR(0, 1730, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_all_keys = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_init_all_positions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1730, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_all_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_102_init_all_positions(__pyx_self, __pyx_v_self, __pyx_v_all_keys);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_102_init_all_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_all_keys) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_all_positions", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1738
 *         :return: None
 *         """
 *         self._c_init_accs_depots(list(all_keys))             # <<<<<<<<<<<<<<
 * 
 *     def _reset_storage(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_init_accs_depots); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PySequence_List(__pyx_v_all_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1730
 *             raise e
 * 
 *     def _init_all_positions(self, all_keys):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes positions (self.depot_position and self.depot_composite_positions)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._init_all_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1740
 *         self._c_init_accs_depots(list(all_keys))
 * 
 *     def _reset_storage(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage (before self.run() is called):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_105_reset_storage(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_104_reset_storage[] = "\n        Resets internal storage (before self.run() is called):\n            self.signals, self.positions, self.merged_positions, self.total_balances\n            and self.merged_total_balances and internal self._signals_at_step_t\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_105_reset_storage = {"_reset_storage", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_105_reset_storage, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_104_reset_storage};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_105_reset_storage(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reset_storage (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_104_reset_storage(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_104_reset_storage(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reset_storage", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1747
 *         :return: None
 *         """
 *         self._c_reset_storage()             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_reset_storage); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1740
 *         self._c_init_accs_depots(list(all_keys))
 * 
 *     def _reset_storage(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage (before self.run() is called):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._reset_storage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1749
 *         self._c_reset_storage()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage of FXStrategy and storage of accounts. Restores account depot status to the same
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_107reset(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_106reset[] = "\n        Resets internal storage of FXStrategy and storage of accounts. Restores account depot status to the same\n        status as of time of calling FXStrategy.__init__(), keeps kwargs saved. Same applies to account.clock as they\n        are restored to the same status as of the time of initialization of FXStrategy.\n        Total reset as if FXStrategy was freshly initialized.\n        Internal reset is done BEFORE each run, but not after!\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_107reset = {"reset", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_107reset, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_106reset};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_107reset(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_106reset(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_106reset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1758
 *         :return: None
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 * 
 *     def _tick_method(self, dict data):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_reset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1749
 *         self._c_reset_storage()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage of FXStrategy and storage of accounts. Restores account depot status to the same
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1760
 *         self.c_reset()
 * 
 *     def _tick_method(self, dict data):             # <<<<<<<<<<<<<<
 *         """
 *         Default ticking method if self.suppress_ticking=False and None passed to self.tick_func at
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_109_tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_108_tick_method[] = "\n        Default ticking method if self.suppress_ticking=False and None passed to self.tick_func at\n        FXStrategy.__init__(). Implementation is based on FXAccount as well as patched version via\n        trapeza.account.order_management.monkey_patch().\n\n        :param data: dict with key:(base, quote) and value:current_exchange_rate or value:list of exchange_rates,\n                     {(base, quote): current_rate,\n                     (base, quote): current_rate,\n                      ...}\n                     or\n                     {(base, quote): [rate_-2, rate_-1, current_rate],\n                     (base, quote): [rate_-2, rate_-1, current_rate],\n                      ...}\n                     (dependent on size of parameter lookback)\n\n                     if dict value: list of exchange_rates:\n                        Only last value will be taken into account such that, if historic data has been prepended to\n                        the data frame according to param:lookback, no changes to the data frame are needed; just pass\n                        current data frame in without worrying about lookback.\n\n                     if accounts are patched with trapeza.account.order_management:\n                        if None, order management is not executed (orders may expire at next tick) but only\n                        _exec_heap, which manages processing of delayed transaction (e.g. due to processing time\n                        of broker). Keys of param:data, that are not listed within account._order_heap\n                        (list of all open orders annotated with base|quote pair), are ignored.\n\n                     Exchange rate is expressed in FX notation convention (direct notation, not volume notation)\n                     1.2 EUR|USD --> 1.2 USD for 1 EUR\n        :return: None\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_109_tick_method = {"_tick_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_109_tick_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_108_tick_method};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_109_tick_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_tick_method (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_tick_method", 1, 2, 2, 1); __PYX_ERR(0, 1760, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_tick_method") < 0)) __PYX_ERR(0, 1760, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_tick_method", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1760, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyDict_Type), 1, "data", 1))) __PYX_ERR(0, 1760, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_108_tick_method(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_108_tick_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  short __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tick_method", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1791
 *         :return: None
 *         """
 *         _c_tick_method(self, data)             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, dict data_frame, str reference_currency, append_to_results):
 */
  __pyx_t_1 = __pyx_f_7trapeza_8strategy_11fx_strategy__c_tick_method(__pyx_v_self, __pyx_v_data, 0); if (unlikely(__pyx_t_1 == ((short)-1))) __PYX_ERR(0, 1791, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1760
 *         self.c_reset()
 * 
 *     def _tick_method(self, dict data):             # <<<<<<<<<<<<<<
 *         """
 *         Default ticking method if self.suppress_ticking=False and None passed to self.tick_func at
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy._tick_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1793
 *         _c_tick_method(self, data)
 * 
 *     def evaluate(self, dict data_frame, str reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluates accounts regarding position sizes and total balances (expressed in reference currency), as well as
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_111evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_110evaluate[] = "\n        Evaluates accounts regarding position sizes and total balances (expressed in reference currency), as well as\n        all signals, which have been appended via FXStrategy.add_signal() method beforehand calling self.evaluate().\n\n        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n        Ticking and adding signals have to be done before evaluation! Ticking is not included in evaluate!\n        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n        Cleans signals, which are temporarily appended via FXStrategy.add_signal for time step t, so be careful when\n        manually calling this method (when append_to_results=True).\n        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n        This method gets called at every iteration during looping through data supplied to FXStrategy.run().\n\n        If append_to_results=True, results from evaluation of current time step t will be appended to internal storage\n        of self.signals, self.depot_positions, self.depot_composite_positions, self.depot_total_balances\n        and self.depot_composite_total_balances, which hold final results for subsequent analysis via backtesting\n        engine. self._signals_at_step_t gets cleaned if append_to_results_True (which temporarily holds added signals).\n        If append_to_results=False, results will not be appended and self.evaluate() will not have any internal\n        effects (only returning raw evaluation of current time step t, does not clean anything).\n\n        Recommendation: use FXStrategy.positions, FXStrategy.total_balances etc. instead of returned values from\n                        FXStrategy.evaluate() in order to retrieve results.\n\n        :param data_frame: ""dict with key:(base, quote) and value:exchange_rate or\n                           value:[exchange_rate_-2, exchange_rate_-1, exchange_rate_0] depending\n                           on value of self.lookback.\n                           If called from self.run(), this is handled automatically.\n                           If called manually, make sure data_frame is consistent in size (time steps) regarding\n                           lookback + 1\n\n                           e.g.:\n                           dict with key:tuple(str, str) and value: float or value:list of floats or\n                           value: array of floats,\n                           {(base, quote): current_rate,\n                            (base, quote): current_rate,\n                             ...}\n                           or\n                           {(base, quote): [rate_-2, rate_-1, current_rate],\n                            (base, quote): [rate_-2, rate_-1, current_rate],\n                             ...}\n                           --> dependent on size of parameter lookback (whether to prepend historic data to each call\n                               to strategy decision function for each loop within FXStrategy.run())\n        :param reference_currency: str,\n                                   reference currency to bill total balances in\n        :param append_to_results: bool,\n                                  if True: appends results to self.signals, self.positions, self.merged_positions,\n                                   self.total_balances and self.merged_total_balances such that backtesting engine can\n                                   use results for subsequent analysis\n                                  if False: does not append results to internal storage, self.evaluate() method does\n                                  not take any effects on internal/ final results\n        :return: signals: list of lists,\n                          [[sig_acc_0, sig_acc_0, ...""],\n                           [sig_acc_1, sig_acc_1, ...], ...]\n                          each list contains signals of each account at time step t\n                 positions: list of dicts per account with key:str and value:amount\n                            key: currency, value: exchange rate\n                            [dict_acc_0, dict_acc_1, ...]\n                            with dict_acc_x = {currency: amount, currency: amount, ...}\n                            each dict contains all positions and corresponding volume per account\n                            positions and corresponding amount/ volume per account at time step t\n                 total_balances: list of floats,\n                                 [tot_bal_acc_0, tot_bal_acc_1, ...]\n                                 total balance of each account in param:reference_currency at time step t\n        :raises: KeyError: if exchange_rates do not include all currencies listed in account depots or if reference\n                           currency is not listed in data_frame\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_111evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_111evaluate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_110evaluate};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_111evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data_frame = 0;
  PyObject *__pyx_v_reference_currency = 0;
  PyObject *__pyx_v_append_to_results = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data_frame,&__pyx_n_s_reference_currency,&__pyx_n_s_append_to_results,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_frame)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 4, 4, 1); __PYX_ERR(0, 1793, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reference_currency)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 4, 4, 2); __PYX_ERR(0, 1793, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_append_to_results)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 4, 4, 3); __PYX_ERR(0, 1793, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 1793, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_data_frame = ((PyObject*)values[1]);
    __pyx_v_reference_currency = ((PyObject*)values[2]);
    __pyx_v_append_to_results = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data_frame), (&PyDict_Type), 1, "data_frame", 1))) __PYX_ERR(0, 1793, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference_currency), (&PyUnicode_Type), 1, "reference_currency", 1))) __PYX_ERR(0, 1793, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_110evaluate(__pyx_self, __pyx_v_self, __pyx_v_data_frame, __pyx_v_reference_currency, __pyx_v_append_to_results);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_110evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_frame, PyObject *__pyx_v_reference_currency, PyObject *__pyx_v_append_to_results) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1863
 *                            currency is not listed in data_frame
 *         """
 *         return self.c_wrap_evaluate(data_frame, reference_currency.encode(), append_to_results)             # <<<<<<<<<<<<<<
 * 
 *     def add_signal(self, acc, str signal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_wrap_evaluate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_v_reference_currency == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1863, __pyx_L1_error)
  }
  __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_reference_currency, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_data_frame, __pyx_t_3, __pyx_v_append_to_results};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_data_frame, __pyx_t_3, __pyx_v_append_to_results};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_data_frame);
    __Pyx_GIVEREF(__pyx_v_data_frame);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_data_frame);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_append_to_results);
    __Pyx_GIVEREF(__pyx_v_append_to_results);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_append_to_results);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1793
 *         _c_tick_method(self, data)
 * 
 *     def evaluate(self, dict data_frame, str reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluates accounts regarding position sizes and total balances (expressed in reference currency), as well as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1865
 *         return self.c_wrap_evaluate(data_frame, reference_currency.encode(), append_to_results)
 * 
 *     def add_signal(self, acc, str signal):             # <<<<<<<<<<<<<<
 *         """
 *         Adds signal of specific account for current time step t, which is then automatically processed and appended to
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_113add_signal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_112add_signal[] = "\n        Adds signal of specific account for current time step t, which is then automatically processed and appended to\n        overall result when self.evaluate() is called with append_to_results=True.\n        Handles format parsing of results automatically.\n        Gets cleaned for next time step every time FXStrategy.evaluate() is called, which happens at every iteration\n        through data supplied to FXStrategy.run() method.\n        Just call add_signal within strategy_func every time a new signal is generated at specific time step t\n        (be cautious when calling evaluate() method manually, as this cleans all current signals without evaluating/\n        appending them to results!).\n\n        If FXDashboard shall be used for visualization:\n            if signal string contains currency (or whatever is defined by data dict, see FXStrategy.run()) as substring,\n            signal will be appropriately visualized on the same line chart as currency. If signal string contains\n            one of the keys of param:signal_symbols dict at FXDashboard.__init__ as substring, signal will be\n            appropriately visualized with therein defined symbol shape and color.\n            signal string therefore must not contain multiple currencies as substring, nor multiple keys of\n            param:signal_symbols dict at FXDashboard.__init__, but only one currency and only one key of\n            param:signal_symbols as substring.\n            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n            !!! signal names, which are appended with FXStrategy.add_signal(), should not contain multiple substrings\n                of either currencies (or assets or whatever defines keys of FXEngine.price_data dictionary) nor keys\n                of shape defining dictionary (param:signal_symbols at FXDashboard.__init__) !!!\n                Recommendation: signal names should be mutual free of substring parts"" to each other,\n                otherwise they might be visualized multiple times at FXDashboard !!!\n            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n        :param acc: FXAccount object (or other Account object inherited from BaseAccount) which to add signal for\n        :param signal: str,\n                       unique string describing trading signal, such as 'buy', 'sell', 'short', 'long'. Signals are\n                       used for visualization in subsequent backtesting analysis.\n        :return: None\n        :raises: ValueError, if param:acc not in self.accounts\n                 TypeError, if signal not str, only thrown if ignore_type_checking is False\n                            (type_checking enabled at __init__)\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_113add_signal = {"add_signal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_113add_signal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_112add_signal};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_113add_signal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_acc = 0;
  PyObject *__pyx_v_signal = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_signal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_acc,&__pyx_n_s_signal,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_signal", 1, 3, 3, 1); __PYX_ERR(0, 1865, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_signal", 1, 3, 3, 2); __PYX_ERR(0, 1865, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_signal") < 0)) __PYX_ERR(0, 1865, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_acc = values[1];
    __pyx_v_signal = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_signal", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1865, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signal), (&PyUnicode_Type), 1, "signal", 1))) __PYX_ERR(0, 1865, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_112add_signal(__pyx_self, __pyx_v_self, __pyx_v_acc, __pyx_v_signal);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_112add_signal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_acc, PyObject *__pyx_v_signal) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_signal", 0);

  /* "trapeza/strategy/fx_strategy.pyx":1901
 *                             (type_checking enabled at __init__)
 *         """
 *         check_types([signal], [str], ['signal'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *         try:
 *             i = self.accounts.index(acc)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_signal);
  __Pyx_GIVEREF(__pyx_v_signal);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_signal);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_n_u_signal);
  __Pyx_GIVEREF(__pyx_n_u_signal);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_signal);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1902
 *         """
 *         check_types([signal], [str], ['signal'], self._c_ignore_type_checking)
 *         try:             # <<<<<<<<<<<<<<
 *             i = self.accounts.index(acc)
 *         except ValueError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "trapeza/strategy/fx_strategy.pyx":1903
 *         check_types([signal], [str], ['signal'], self._c_ignore_type_checking)
 *         try:
 *             i = self.accounts.index(acc)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             i = self.accounts.index(acc[0])
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_accounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1903, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1903, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_2, __pyx_v_acc) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_acc);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1903, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_i = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":1902
 *         """
 *         check_types([signal], [str], ['signal'], self._c_ignore_type_checking)
 *         try:             # <<<<<<<<<<<<<<
 *             i = self.accounts.index(acc)
 *         except ValueError:
 */
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":1904
 *         try:
 *             i = self.accounts.index(acc)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             i = self.accounts.index(acc[0])
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(0, 1904, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_2);

      /* "trapeza/strategy/fx_strategy.pyx":1905
 *             i = self.accounts.index(acc)
 *         except ValueError:
 *             i = self.accounts.index(acc[0])             # <<<<<<<<<<<<<<
 * 
 *         self.c_add_signal(i, signal.encode())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_accounts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1905, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1905, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_acc, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1905, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1905, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "trapeza/strategy/fx_strategy.pyx":1902
 *         """
 *         check_types([signal], [str], ['signal'], self._c_ignore_type_checking)
 *         try:             # <<<<<<<<<<<<<<
 *             i = self.accounts.index(acc)
 *         except ValueError:
 */
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    __pyx_L8_try_end:;
  }

  /* "trapeza/strategy/fx_strategy.pyx":1907
 *             i = self.accounts.index(acc[0])
 * 
 *         self.c_add_signal(i, signal.encode())             # <<<<<<<<<<<<<<
 * 
 *     def run(self, dict price_data, str reference_currency, volume_data=None):
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_add_signal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (unlikely(__pyx_v_signal == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 1907, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsEncodedString(__pyx_v_signal, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_i, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1907, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_i, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1907, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_i);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1865
 *         return self.c_wrap_evaluate(data_frame, reference_currency.encode(), append_to_results)
 * 
 *     def add_signal(self, acc, str signal):             # <<<<<<<<<<<<<<
 *         """
 *         Adds signal of specific account for current time step t, which is then automatically processed and appended to
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.add_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "trapeza/strategy/fx_strategy.pyx":1909
 *         self.c_add_signal(i, signal.encode())
 * 
 *     def run(self, dict price_data, str reference_currency, volume_data=None):             # <<<<<<<<<<<<<<
 *         """
 *         Runs strategy_func with supplied data. Data is fed in via looping through every time step of data.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_115run(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_114run[] = "\n        Runs strategy_func with supplied data. Data is fed in via looping through every time step of data.\n        At each loop, lookback defines number of previous time steps, which are prepended to current time step t and\n        which are then fed into decision function (strategy decision function receives lookback + current time steps as\n        data time frame of currency pairs (base|quote) and their exchange rate/ volumes at those time steps all at\n        once).\n        Historic data for using lookback parameter has to be prepended manually to data before passing to this method.\n        Start time step is therefore at index=lookback with respect to data, which passed into this method.\n        If 'lookback = length_of_data (all time steps) -1', then run is only called once internally (for loop reduced\n        to one single iteration, which is useful if strategy decision function shall only be called once, e.g. when\n        strategy decision function is heavily vectorized for performance reasons, even though ticking and adding\n        signals have to be handled manually within strategy_func).\n        If 'lookback = 0', only one (current) time step will be fed to strategy decision function at each loop\n        (number of loops equals number of time steps contained in data). See param:price_data for data format and how\n        time steps are arranged.\n\n        Reference currency is used to calculate total balances of accounts after executing\n        strategy_func.\n\n        If ticking is not done within strategy decision function, then this method attempts to tick all accounts, as\n        long as param:suppress_ticking at FXStrategy.__init__() is not set to True. If set to True, FXStrategy.run()\n        will not attempt to tick accounts, but accounts can still be ticked from inside the strategy decision function.\n        Raises exception, if ticking is not possible (detected via account.clocks) and suppress_ticking=False.\n\n        At each ""call to run, FXStrategy internal storage (which hold final results) and accounts are reset.\n        Additionally depots and clocks of accounts are reset to the same depot and clock status as when\n        FXStrategy.__init__() was called.\n        This means, FXStrategy.run() can be called repeatedly in such a way, that each call simulates an independent\n        simulation run starting from the same account status as at time of FXStrategy.__init__() at every run. Calling\n        FXStrategy.run() repeatedly is therefore safe and just simulates every time starting as if accounts have been\n        freshly initialized with their initial account.depot and account.clock status as well as a fresh internal\n        storage of FXStrategy.\n\n        Additionally, volume data can be passed to strategy decision function. If volume data is None, then None value\n        will be passed to strategy_func. If volume data is a dict in the same format as price data, then same logic as\n        for price data is applied regarding lookback handling and iterating over volume data. Volume data is then\n        iterated over for each time step with respective lookback portion. Volume data only has to comply to price\n        data as it has to take the same data format. Keys of volume data can be chosen independently from price\n        data (but have to be tuples of strings). No further checks (e.g. if ('BTC', 'EUR') key is inverse to\n        ('EUR', 'BTC')) are applied to volume data.\n\n        Results can be accessed via 'self.positions', 'self.merged_positions', 'self.total_balances',\n        'self.merged_total_balances', 'self.signals'. See docstring class description for more information.\n\n        Internal reset is done BEFORE each run, but not after!\n\n        :param price_data: dict with:\n                     keys: currency pair as tuple of strings: (currency_0, currency_1)\n                     values: list of floats as exchange rates per time step t or array of floats""\n\n                     {(base, quote): [rate_0, rate_1, ..., rate_t],\n                      (base, quote): [rate_0, rate_1, ..., rate_t],\n                      ...}\n\n                     All values (list or array of floats) of all keys (currency pairs) have to be of same length.\n\n                     If historic data shall be used by strategy_func (cf. lookback), historic data has to be prepended\n                     manually to param:data, e.g.:\n                         lookback = 3\n\n                         {(base, quote): [rate_-3, rate_-2, rate_-1, rate_0, rate_1, ... rate_t],\n                          (base, quote): [rate_-3, rate_-2, rate_-1, rate_0, rate_1, ... rate_t],\n                          ...}\n\n                     Data will be looped through one by one (time frame specified by lookback and current time step t\n                     [size: lookback + 1]). Start time step is at index=lookback.\n\n                     Exchange rate is expressed in FX notation convention (direct notation, not volume notation)\n                     1.2 EUR|USD --> 1.2 USD for 1 EUR\n\n                     None values allowed (if handling via accounts during account.tick(data_point_t) is ensured.\n                     data_point_t is a data dict only containing time steps which are fed to strategy decision function\n                     at each loop).\n\n                     if accounts are patched with trapeza.account.order_management:\n                        if None value occurs, order management is not executed (orders may expire at next tick) but only\n                        _exec_heap, which manages processing of delayed transaction (e.g. due to processing time\n                        of broker). Keys of param:data, that are not listed within account._order_heap\n                        (list of all open orders annotated with base|quote pair), are ignored.\n        :param reference_currency: str,\n                                   reference currency ""in which to bill total balances of all accounts\n        :param volume_data: None or dict,\n                            If None, then None value is also passed to strategy decision function.\n                            If dict, then dict must be in the same format as param:price_data. Instead of price data,\n                                place volume data (or whatever data shall be used within strategy decision function) as\n                                values. Keys (tuple of strings, which annotate e.g. currencies) do not have to be\n                                identical to keys of param:price_data. No cross volume checking applied, which means\n                                that e.g. ('BTC', 'EUR') does not have to match up against ('EUR', 'BTC'). Data input\n                                at one's own caution. Lookbacks are handled in the same manner as in param:price_data.\n        :return: reference_currency: str,\n                                     see param:reference_currency\n                 self.signals: list of lists,\n                               see Class Docstring\n                 self.positions: dict,\n                                 see Class Docstring\n                 self.merged_positions: dict,\n                                        see Class Docstring\n                 self.total_balances: list of lists,\n                                      see Class Docstring\n                 self.merged_total_balances: list,\n                                             see Class Docstring\n        :raises: IndexError: if dict values (list or array of floats) of param:data do not have same length,\n                             only thrown if ignore_type_checking is False (type_checking enabled at __init__)\n                 ValueError: if length dict values (list or array of floats) is less than lookback + 1\n                 TypeError: if types do not match up,\n                            only thrown if ignore_type_checking is False (""type_checking enabled at __init__)\n                 trapeza.OperatingError: if accounts have not been ticked (when suppress ticking=True)\n\n        # TODO: return special value if transactions have been ignored during run (e.g. coverage exception at account)\n        ";
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_115run = {"run", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_115run, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_10FXStrategy_114run};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_10FXStrategy_115run(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_price_data = 0;
  PyObject *__pyx_v_reference_currency = 0;
  PyObject *__pyx_v_volume_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_price_data,&__pyx_n_s_reference_currency,&__pyx_n_s_volume_data,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_price_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run", 0, 3, 4, 1); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reference_currency)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run", 0, 3, 4, 2); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_volume_data);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run") < 0)) __PYX_ERR(0, 1909, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_price_data = ((PyObject*)values[1]);
    __pyx_v_reference_currency = ((PyObject*)values[2]);
    __pyx_v_volume_data = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("run", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1909, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_price_data), (&PyDict_Type), 1, "price_data", 1))) __PYX_ERR(0, 1909, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference_currency), (&PyUnicode_Type), 1, "reference_currency", 1))) __PYX_ERR(0, 1909, __pyx_L1_error)
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_114run(__pyx_self, __pyx_v_self, __pyx_v_price_data, __pyx_v_reference_currency, __pyx_v_volume_data);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_10FXStrategy_114run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_price_data, PyObject *__pyx_v_reference_currency, PyObject *__pyx_v_volume_data) {
  Py_ssize_t __pyx_v_len_data;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  Py_ssize_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("run", 0);
  __Pyx_INCREF(__pyx_v_volume_data);

  /* "trapeza/strategy/fx_strategy.pyx":2023
 *         # dict = {(base, quote): [val_0, val_1, ..., val_t], (base, quote): [val_0, val_1, ..., val_t]}
 * 
 *         len_data = len(price_data[list(price_data.keys())[0]])             # <<<<<<<<<<<<<<
 * 
 *         # >>>type checking
 */
  if (unlikely(__pyx_v_price_data == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 2023, __pyx_L1_error)
  }
  if (unlikely(__pyx_v_price_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 2023, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_price_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_price_data, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2023, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_len_data = __pyx_t_3;

  /* "trapeza/strategy/fx_strategy.pyx":2026
 * 
 *         # >>>type checking
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             # >>price data
 *             check_types([price_data], [dict], ['price_data'], self._c_ignore_type_checking)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "trapeza/strategy/fx_strategy.pyx":2028
 *         if not self._c_ignore_type_checking:
 *             # >>price data
 *             check_types([price_data], [dict], ['price_data'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *             for k in price_data.keys():
 *                 check_types([k], [tuple], ['price_data_key'], self._c_ignore_type_checking)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_price_data);
    __Pyx_GIVEREF(__pyx_v_price_data);
    PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_price_data);
    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
    PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyDict_Type)));
    __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_n_u_price_data);
    __Pyx_GIVEREF(__pyx_n_u_price_data);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_price_data);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_9);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":2029
 *             # >>price data
 *             check_types([price_data], [dict], ['price_data'], self._c_ignore_type_checking)
 *             for k in price_data.keys():             # <<<<<<<<<<<<<<
 *                 check_types([k], [tuple], ['price_data_key'], self._c_ignore_type_checking)
 *                 check_types([k[0], k[1]], [str, str], ['price_data_key_tuple_0', 'price_data_key_tuple_1'],
 */
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_price_data == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
      __PYX_ERR(0, 2029, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_price_data, 1, __pyx_n_s_keys, (&__pyx_t_13), (&__pyx_t_11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
    while (1) {
      __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_13, &__pyx_t_3, &__pyx_t_1, NULL, NULL, __pyx_t_11);
      if (unlikely(__pyx_t_14 == 0)) break;
      if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 2029, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2030
 *             check_types([price_data], [dict], ['price_data'], self._c_ignore_type_checking)
 *             for k in price_data.keys():
 *                 check_types([k], [tuple], ['price_data_key'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 check_types([k[0], k[1]], [str, str], ['price_data_key_tuple_0', 'price_data_key_tuple_1'],
 *                             self._c_ignore_type_checking)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_check_types); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2030, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2030, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_k);
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2030, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(((PyObject *)(&PyTuple_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type)));
      PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)(&PyTuple_Type)));
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2030, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_n_u_price_data_key);
      __Pyx_GIVEREF(__pyx_n_u_price_data_key);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_price_data_key);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2030, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_6);
        __pyx_t_9 = 0;
        __pyx_t_8 = 0;
        __pyx_t_7 = 0;
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2031
 *             for k in price_data.keys():
 *                 check_types([k], [tuple], ['price_data_key'], self._c_ignore_type_checking)
 *                 check_types([k[0], k[1]], [str, str], ['price_data_key_tuple_0', 'price_data_key_tuple_1'],             # <<<<<<<<<<<<<<
 *                             self._c_ignore_type_checking)
 *                 # sample check
 */
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_check_types); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_k, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_k, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
      __pyx_t_15 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
      PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyUnicode_Type)));
      __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
      PyList_SET_ITEM(__pyx_t_6, 1, ((PyObject *)(&PyUnicode_Type)));
      __pyx_t_15 = PyList_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_n_u_price_data_key_tuple_0);
      __Pyx_GIVEREF(__pyx_n_u_price_data_key_tuple_0);
      PyList_SET_ITEM(__pyx_t_15, 0, __pyx_n_u_price_data_key_tuple_0);
      __Pyx_INCREF(__pyx_n_u_price_data_key_tuple_1);
      __Pyx_GIVEREF(__pyx_n_u_price_data_key_tuple_1);
      PyList_SET_ITEM(__pyx_t_15, 1, __pyx_n_u_price_data_key_tuple_1);

      /* "trapeza/strategy/fx_strategy.pyx":2032
 *                 check_types([k], [tuple], ['price_data_key'], self._c_ignore_type_checking)
 *                 check_types([k[0], k[1]], [str, str], ['price_data_key_tuple_0', 'price_data_key_tuple_1'],
 *                             self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 # sample check
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2032, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_7, __pyx_t_6, __pyx_t_15, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2031, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_7, __pyx_t_6, __pyx_t_15, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2031, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2031, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_14, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_14, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_14, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_14, __pyx_t_8);
        __pyx_t_7 = 0;
        __pyx_t_6 = 0;
        __pyx_t_15 = 0;
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2031, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2034
 *                             self._c_ignore_type_checking)
 *                 # sample check
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 if len(price_data[k]) != len_data:
 *                     raise IndexError('Not all time series of all tuple keys within supplied price data dict have the '
 */
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_check_types); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (unlikely(__pyx_v_price_data == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2034, __pyx_L1_error)
      }
      __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_price_data, __pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
      PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)(&PyFloat_Type)));
      __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_n_u_price_data_value);
      __Pyx_GIVEREF(__pyx_n_u_price_data_value);
      PyList_SET_ITEM(__pyx_t_15, 0, __pyx_n_u_price_data_value);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2034, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_10, __pyx_t_8, __pyx_t_15, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2034, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_10, __pyx_t_8, __pyx_t_15, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2034, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_14, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_14, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_14, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_14, __pyx_t_6);
        __pyx_t_10 = 0;
        __pyx_t_8 = 0;
        __pyx_t_15 = 0;
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2034, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2035
 *                 # sample check
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)
 *                 if len(price_data[k]) != len_data:             # <<<<<<<<<<<<<<
 *                     raise IndexError('Not all time series of all tuple keys within supplied price data dict have the '
 *                                      'same length.')
 */
      if (unlikely(__pyx_v_price_data == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 2035, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_price_data, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_16 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2035, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = ((__pyx_t_16 != __pyx_v_len_data) != 0);
      if (unlikely(__pyx_t_5)) {

        /* "trapeza/strategy/fx_strategy.pyx":2036
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)
 *                 if len(price_data[k]) != len_data:
 *                     raise IndexError('Not all time series of all tuple keys within supplied price data dict have the '             # <<<<<<<<<<<<<<
 *                                      'same length.')
 *             # >>volume data
 */
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2036, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 2036, __pyx_L1_error)

        /* "trapeza/strategy/fx_strategy.pyx":2035
 *                 # sample check
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)
 *                 if len(price_data[k]) != len_data:             # <<<<<<<<<<<<<<
 *                     raise IndexError('Not all time series of all tuple keys within supplied price data dict have the '
 *                                      'same length.')
 */
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":2039
 *                                      'same length.')
 *             # >>volume data
 *             if volume_data is not None:             # <<<<<<<<<<<<<<
 *                 check_types([volume_data], [dict], ['volume_data'], self._c_ignore_type_checking)
 *                 for k in volume_data.keys():
 */
    __pyx_t_5 = (__pyx_v_volume_data != Py_None);
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "trapeza/strategy/fx_strategy.pyx":2040
 *             # >>volume data
 *             if volume_data is not None:
 *                 check_types([volume_data], [dict], ['volume_data'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                 for k in volume_data.keys():
 *                     check_types([k], [tuple], ['volume_data_key'], self._c_ignore_type_checking)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2040, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2040, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_volume_data);
      __Pyx_GIVEREF(__pyx_v_volume_data);
      PyList_SET_ITEM(__pyx_t_12, 0, __pyx_v_volume_data);
      __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2040, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
      PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)(&PyDict_Type)));
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2040, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_n_u_volume_data);
      __Pyx_GIVEREF(__pyx_n_u_volume_data);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_volume_data);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2040, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_8 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_12, __pyx_t_9, __pyx_t_6, __pyx_t_15};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_12, __pyx_t_9, __pyx_t_6, __pyx_t_15};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2040, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_11, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_11, __pyx_t_15);
        __pyx_t_12 = 0;
        __pyx_t_9 = 0;
        __pyx_t_6 = 0;
        __pyx_t_15 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2041
 *             if volume_data is not None:
 *                 check_types([volume_data], [dict], ['volume_data'], self._c_ignore_type_checking)
 *                 for k in volume_data.keys():             # <<<<<<<<<<<<<<
 *                     check_types([k], [tuple], ['volume_data_key'], self._c_ignore_type_checking)
 *                     check_types([k[0], k[1]], [str, str], ['volume_data_key_tuple_0', 'volume_data_key_tuple_1'],
 */
      __pyx_t_13 = 0;
      if (unlikely(__pyx_v_volume_data == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
        __PYX_ERR(0, 2041, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_volume_data, 0, __pyx_n_s_keys, (&__pyx_t_3), (&__pyx_t_11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_1;
      __pyx_t_1 = 0;
      while (1) {
        __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_3, &__pyx_t_13, &__pyx_t_1, NULL, NULL, __pyx_t_11);
        if (unlikely(__pyx_t_14 == 0)) break;
        if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 2041, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":2042
 *                 check_types([volume_data], [dict], ['volume_data'], self._c_ignore_type_checking)
 *                 for k in volume_data.keys():
 *                     check_types([k], [tuple], ['volume_data_key'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                     check_types([k[0], k[1]], [str, str], ['volume_data_key_tuple_0', 'volume_data_key_tuple_1'],
 *                                 self._c_ignore_type_checking)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_check_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_v_k);
        __Pyx_GIVEREF(__pyx_v_k);
        PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_k);
        __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(((PyObject *)(&PyTuple_Type)));
        __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type)));
        PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyTuple_Type)));
        __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_n_u_volume_data_key);
        __Pyx_GIVEREF(__pyx_n_u_volume_data_key);
        PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_u_volume_data_key);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_14 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_15, __pyx_t_6, __pyx_t_9, __pyx_t_12};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_t_15, __pyx_t_6, __pyx_t_9, __pyx_t_12};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_14, __pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_14, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_14, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_14, __pyx_t_12);
          __pyx_t_15 = 0;
          __pyx_t_6 = 0;
          __pyx_t_9 = 0;
          __pyx_t_12 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":2043
 *                 for k in volume_data.keys():
 *                     check_types([k], [tuple], ['volume_data_key'], self._c_ignore_type_checking)
 *                     check_types([k[0], k[1]], [str, str], ['volume_data_key_tuple_0', 'volume_data_key_tuple_1'],             # <<<<<<<<<<<<<<
 *                                 self._c_ignore_type_checking)
 *                     # sample check
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_check_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_k, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_k, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_7);
        PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_12);
        PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_12);
        __pyx_t_7 = 0;
        __pyx_t_12 = 0;
        __pyx_t_12 = PyList_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
        __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
        PyList_SET_ITEM(__pyx_t_12, 0, ((PyObject *)(&PyUnicode_Type)));
        __Pyx_INCREF(((PyObject *)(&PyUnicode_Type)));
        __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type)));
        PyList_SET_ITEM(__pyx_t_12, 1, ((PyObject *)(&PyUnicode_Type)));
        __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2043, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_n_u_volume_data_key_tuple_0);
        __Pyx_GIVEREF(__pyx_n_u_volume_data_key_tuple_0);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_volume_data_key_tuple_0);
        __Pyx_INCREF(__pyx_n_u_volume_data_key_tuple_1);
        __Pyx_GIVEREF(__pyx_n_u_volume_data_key_tuple_1);
        PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_u_volume_data_key_tuple_1);

        /* "trapeza/strategy/fx_strategy.pyx":2044
 *                     check_types([k], [tuple], ['volume_data_key'], self._c_ignore_type_checking)
 *                     check_types([k[0], k[1]], [str, str], ['volume_data_key_tuple_0', 'volume_data_key_tuple_1'],
 *                                 self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                     # sample check
 *                     check_types([volume_data[k][0]], [float], ['volume_data_value'], self._c_ignore_type_checking)
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2044, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_15 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_14 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_15, __pyx_t_9, __pyx_t_12, __pyx_t_7, __pyx_t_6};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_15, __pyx_t_9, __pyx_t_12, __pyx_t_7, __pyx_t_6};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2043, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_15) {
            __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_15); __pyx_t_15 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_14, __pyx_t_6);
          __pyx_t_9 = 0;
          __pyx_t_12 = 0;
          __pyx_t_7 = 0;
          __pyx_t_6 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":2046
 *                                 self._c_ignore_type_checking)
 *                     # sample check
 *                     check_types([volume_data[k][0]], [float], ['volume_data_value'], self._c_ignore_type_checking)             # <<<<<<<<<<<<<<
 *                     if len(volume_data[k]) != len_data:
 *                         raise IndexError
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_check_types); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_volume_data, __pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_6);
        PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(((PyObject *)(&PyFloat_Type)));
        __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type)));
        PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyFloat_Type)));
        __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_n_u_volume_data_value);
        __Pyx_GIVEREF(__pyx_n_u_volume_data_value);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_volume_data_value);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_ignore_type_checking); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_14 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_8, __pyx_t_6, __pyx_t_7, __pyx_t_12};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2046, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_8, __pyx_t_6, __pyx_t_7, __pyx_t_12};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2046, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2046, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9); __pyx_t_9 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_12);
          __pyx_t_8 = 0;
          __pyx_t_6 = 0;
          __pyx_t_7 = 0;
          __pyx_t_12 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2046, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "trapeza/strategy/fx_strategy.pyx":2047
 *                     # sample check
 *                     check_types([volume_data[k][0]], [float], ['volume_data_value'], self._c_ignore_type_checking)
 *                     if len(volume_data[k]) != len_data:             # <<<<<<<<<<<<<<
 *                         raise IndexError
 * 
 */
        __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_volume_data, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_16 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2047, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_4 = ((__pyx_t_16 != __pyx_v_len_data) != 0);
        if (unlikely(__pyx_t_4)) {

          /* "trapeza/strategy/fx_strategy.pyx":2048
 *                     check_types([volume_data[k][0]], [float], ['volume_data_value'], self._c_ignore_type_checking)
 *                     if len(volume_data[k]) != len_data:
 *                         raise IndexError             # <<<<<<<<<<<<<<
 * 
 *         if len_data <= self.lookback:
 */
          __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
          __PYX_ERR(0, 2048, __pyx_L1_error)

          /* "trapeza/strategy/fx_strategy.pyx":2047
 *                     # sample check
 *                     check_types([volume_data[k][0]], [float], ['volume_data_value'], self._c_ignore_type_checking)
 *                     if len(volume_data[k]) != len_data:             # <<<<<<<<<<<<<<
 *                         raise IndexError
 * 
 */
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "trapeza/strategy/fx_strategy.pyx":2039
 *                                      'same length.')
 *             # >>volume data
 *             if volume_data is not None:             # <<<<<<<<<<<<<<
 *                 check_types([volume_data], [dict], ['volume_data'], self._c_ignore_type_checking)
 *                 for k in volume_data.keys():
 */
    }

    /* "trapeza/strategy/fx_strategy.pyx":2026
 * 
 *         # >>>type checking
 *         if not self._c_ignore_type_checking:             # <<<<<<<<<<<<<<
 *             # >>price data
 *             check_types([price_data], [dict], ['price_data'], self._c_ignore_type_checking)
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":2050
 *                         raise IndexError
 * 
 *         if len_data <= self.lookback:             # <<<<<<<<<<<<<<
 *             raise ValueError('Data does not contain enough time steps: {}. '
 *                              'Data has to contain more time steps than '
 */
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_len_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lookback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(__pyx_t_4)) {

    /* "trapeza/strategy/fx_strategy.pyx":2053
 *             raise ValueError('Data does not contain enough time steps: {}. '
 *                              'Data has to contain more time steps than '
 *                              'specified by lookback: {}.'.format(len_data, self.lookback))             # <<<<<<<<<<<<<<
 * 
 *         if volume_data is None:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Data_does_not_contain_enough_tim, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_len_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lookback); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_12 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_15};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_15};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_t_15);
      __pyx_t_2 = 0;
      __pyx_t_15 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":2051
 * 
 *         if len_data <= self.lookback:
 *             raise ValueError('Data does not contain enough time steps: {}. '             # <<<<<<<<<<<<<<
 *                              'Data has to contain more time steps than '
 *                              'specified by lookback: {}.'.format(len_data, self.lookback))
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2051, __pyx_L1_error)

    /* "trapeza/strategy/fx_strategy.pyx":2050
 *                         raise IndexError
 * 
 *         if len_data <= self.lookback:             # <<<<<<<<<<<<<<
 *             raise ValueError('Data does not contain enough time steps: {}. '
 *                              'Data has to contain more time steps than '
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":2055
 *                              'specified by lookback: {}.'.format(len_data, self.lookback))
 * 
 *         if volume_data is None:             # <<<<<<<<<<<<<<
 *             volume_data = {}
 * 
 */
  __pyx_t_4 = (__pyx_v_volume_data == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "trapeza/strategy/fx_strategy.pyx":2056
 * 
 *         if volume_data is None:
 *             volume_data = {}             # <<<<<<<<<<<<<<
 * 
 *         return self.c_wrap_run(price_data, reference_currency.encode(), volume_data, len_data)
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_volume_data, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "trapeza/strategy/fx_strategy.pyx":2055
 *                              'specified by lookback: {}.'.format(len_data, self.lookback))
 * 
 *         if volume_data is None:             # <<<<<<<<<<<<<<
 *             volume_data = {}
 * 
 */
  }

  /* "trapeza/strategy/fx_strategy.pyx":2058
 *             volume_data = {}
 * 
 *         return self.c_wrap_run(price_data, reference_currency.encode(), volume_data, len_data)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c_wrap_run); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (unlikely(__pyx_v_reference_currency == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 2058, __pyx_L1_error)
  }
  __pyx_t_7 = PyUnicode_AsEncodedString(__pyx_v_reference_currency, NULL, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_len_data); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_2 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_price_data, __pyx_t_7, __pyx_v_volume_data, __pyx_t_15};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_price_data, __pyx_t_7, __pyx_v_volume_data, __pyx_t_15};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_price_data);
    __Pyx_GIVEREF(__pyx_v_price_data);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_price_data);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_volume_data);
    __Pyx_GIVEREF(__pyx_v_volume_data);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_volume_data);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_15);
    __pyx_t_7 = 0;
    __pyx_t_15 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "trapeza/strategy/fx_strategy.pyx":1909
 *         self.c_add_signal(i, signal.encode())
 * 
 *     def run(self, dict price_data, str reference_currency, volume_data=None):             # <<<<<<<<<<<<<<
 *         """
 *         Runs strategy_func with supplied data. Data is fed in via looping through every time step of data.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.FXStrategy.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_volume_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_cFXStrategy(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_3__pyx_unpickle_cFXStrategy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7trapeza_8strategy_11fx_strategy_3__pyx_unpickle_cFXStrategy = {"__pyx_unpickle_cFXStrategy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_3__pyx_unpickle_cFXStrategy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7trapeza_8strategy_11fx_strategy_3__pyx_unpickle_cFXStrategy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_cFXStrategy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_cFXStrategy", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_cFXStrategy", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_cFXStrategy") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_cFXStrategy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.__pyx_unpickle_cFXStrategy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7trapeza_8strategy_11fx_strategy_2__pyx_unpickle_cFXStrategy(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7trapeza_8strategy_11fx_strategy_2__pyx_unpickle_cFXStrategy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_cFXStrategy", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2ffa9a0:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x2ffa9a0) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2ffa9a0:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x2ffa9a0:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x2f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x2ffa9a0:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7trapeza_8strategy_11fx_strategy___pyx_unpickle_cFXStrategy__set_state(((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x2ffa9a0 = (_c_accs_clocks, _c_ignore_type_checking, _c_init_accs_depots, _c_signals_at_step_t, c_accounts, c_lookback, c_merged_positions, c_merged_total_balances, c_name, c_positions, c_signals, c_strategy_func, c_strategy_kwargs, c_suppress_ticking, c_tick_kwargs, c_tick_method, c_total_balances))" % __pyx_checksum)
 *     __pyx_result = cFXStrategy.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_cFXStrategy(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.__pyx_unpickle_cFXStrategy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7trapeza_8strategy_11fx_strategy___pyx_unpickle_cFXStrategy__set_state(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  bool __pyx_t_2;
  std::unordered_map<long,std::vector<std::string> >  __pyx_t_3;
  long __pyx_t_4;
  std::unordered_map<std::string,std::vector<double> >  __pyx_t_5;
  std::vector<double>  __pyx_t_6;
  std::string __pyx_t_7;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_t_8;
  std::vector<std::vector<std::vector<std::string> > >  __pyx_t_9;
  std::vector<std::vector<double> >  __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_cFXStrategy__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[17])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_c_accs_clocks);
  __Pyx_DECREF(__pyx_v___pyx_result->_c_accs_clocks);
  __pyx_v___pyx_result->_c_accs_clocks = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_c_ignore_type_checking = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_c_init_accs_depots);
  __Pyx_DECREF(__pyx_v___pyx_result->_c_init_accs_depots);
  __pyx_v___pyx_result->_c_init_accs_depots = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_c_signals_at_step_t = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->c_accounts);
  __Pyx_DECREF(__pyx_v___pyx_result->c_accounts);
  __pyx_v___pyx_result->c_accounts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_lookback = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_merged_positions = __pyx_t_5;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __pyx_convert_vector_from_py_double(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_merged_total_balances = __pyx_t_6;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_name = __pyx_t_7;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_positions = __pyx_t_8;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_signals = __pyx_t_9;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->c_strategy_func);
  __Pyx_DECREF(__pyx_v___pyx_result->c_strategy_func);
  __pyx_v___pyx_result->c_strategy_func = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->c_strategy_kwargs);
  __Pyx_DECREF(__pyx_v___pyx_result->c_strategy_kwargs);
  __pyx_v___pyx_result->c_strategy_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_suppress_ticking = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->c_tick_kwargs);
  __Pyx_DECREF(__pyx_v___pyx_result->c_tick_kwargs);
  __pyx_v___pyx_result->c_tick_kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->c_tick_method);
  __Pyx_DECREF(__pyx_v___pyx_result->c_tick_method);
  __pyx_v___pyx_result->c_tick_method = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_total_balances = __pyx_t_10;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[17])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 13, __pyx_L1_error)
  }
  __pyx_t_12 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  __pyx_t_13 = ((__pyx_t_12 > 17) != 0);
  if (__pyx_t_13) {
  } else {
    __pyx_t_11 = __pyx_t_13;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_13 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  __pyx_t_14 = (__pyx_t_13 != 0);
  __pyx_t_11 = __pyx_t_14;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_11) {

    /* "(tree fragment)":14
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[17])             # <<<<<<<<<<<<<<
 */
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_update); if (unlikely(!__pyx_t_16)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 14, __pyx_L1_error)
    }
    __pyx_t_15 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_17, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_15);
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[17])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_cFXStrategy__set_state(<cFXStrategy> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_cFXStrategy__set_state(cFXStrategy __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._c_accs_clocks = __pyx_state[0]; __pyx_result._c_ignore_type_checking = __pyx_state[1]; __pyx_result._c_init_accs_depots = __pyx_state[2]; __pyx_result._c_signals_at_step_t = __pyx_state[3]; __pyx_result.c_accounts = __pyx_state[4]; __pyx_result.c_lookback = __pyx_state[5]; __pyx_result.c_merged_positions = __pyx_state[6]; __pyx_result.c_merged_total_balances = __pyx_state[7]; __pyx_result.c_name = __pyx_state[8]; __pyx_result.c_positions = __pyx_state[9]; __pyx_result.c_signals = __pyx_state[10]; __pyx_result.c_strategy_func = __pyx_state[11]; __pyx_result.c_strategy_kwargs = __pyx_state[12]; __pyx_result.c_suppress_ticking = __pyx_state[13]; __pyx_result.c_tick_kwargs = __pyx_state[14]; __pyx_result.c_tick_method = __pyx_state[15]; __pyx_result.c_total_balances = __pyx_state[16]
 *     if len(__pyx_state) > 17 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("trapeza.strategy.fx_strategy.__pyx_unpickle_cFXStrategy__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_string", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

static PyObject *__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(std::unordered_map<long,std::vector<std::string> >  const &__pyx_v_s) {
  PyObject *__pyx_v_o = NULL;
  std::unordered_map<long,std::vector<std::string> > ::value_type const *__pyx_v_key_value;
  std::unordered_map<long,std::vector<std::string> > ::const_iterator __pyx_v_iter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___", 0);

  /* "map.to_py":202
 * @cname("__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(const map[X,Y]& s):
 *     o = {}             # <<<<<<<<<<<<<<
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_o = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.to_py":204
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()             # <<<<<<<<<<<<<<
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 */
  __pyx_v_iter = __pyx_v_s.begin();

  /* "map.to_py":205
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():             # <<<<<<<<<<<<<<
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0);
    if (!__pyx_t_2) break;

    /* "map.to_py":206
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)             # <<<<<<<<<<<<<<
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 */
    __pyx_v_key_value = (&(*__pyx_v_iter));

    /* "map.to_py":207
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second             # <<<<<<<<<<<<<<
 *         cython.operator.preincrement(iter)
 *     return o
 */
    __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "map.to_py":208
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
 *     return o
 * 
 */
    (void)((++__pyx_v_iter));
  }

  /* "map.to_py":209
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 *     return o             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_long____std_3a__3a_vector_3c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":14
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0             # <<<<<<<<<<<<<<
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)
 */
  __pyx_v_length = 0;

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(2, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) {
  std::vector<std::string>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::string)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

static std::unordered_map<long,std::vector<std::string> >  __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_d = 0;
  std::unordered_map<long,std::vector<std::string> >  __pyx_v_m;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  std::unordered_map<long,std::vector<std::string> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  std::vector<std::string>  __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___", 0);

  /* "map.from_py":175
 * @cname("__pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:
 *     cdef dict d = o             # <<<<<<<<<<<<<<
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(2, 175, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_o;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.from_py":177
 *     cdef dict d = o
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():             # <<<<<<<<<<<<<<
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(2, 177, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(2, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "map.from_py":178
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))             # <<<<<<<<<<<<<<
 *     return m
 * 
 */
    __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_key); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_t_9 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_v_m.insert(std::pair<long,std::vector<std::string> > (((long)__pyx_t_8), ((std::vector<std::string> )__pyx_t_9)));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "map.from_py":179
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  /* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_long__and_std_3a__3a_vector_3c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(std::unordered_map<std::string,std::vector<double> >  const &__pyx_v_s) {
  PyObject *__pyx_v_o = NULL;
  std::unordered_map<std::string,std::vector<double> > ::value_type const *__pyx_v_key_value;
  std::unordered_map<std::string,std::vector<double> > ::const_iterator __pyx_v_iter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___", 0);

  /* "map.to_py":202
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(const map[X,Y]& s):
 *     o = {}             # <<<<<<<<<<<<<<
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_o = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.to_py":204
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()             # <<<<<<<<<<<<<<
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 */
  __pyx_v_iter = __pyx_v_s.begin();

  /* "map.to_py":205
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():             # <<<<<<<<<<<<<<
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0);
    if (!__pyx_t_2) break;

    /* "map.to_py":206
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)             # <<<<<<<<<<<<<<
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 */
    __pyx_v_key_value = (&(*__pyx_v_iter));

    /* "map.to_py":207
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second             # <<<<<<<<<<<<<<
 *         cython.operator.preincrement(iter)
 *     return o
 */
    __pyx_t_1 = __pyx_convert_vector_to_py_double(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "map.to_py":208
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
 *     return o
 * 
 */
    (void)((++__pyx_v_iter));
  }

  /* "map.to_py":209
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 *     return o             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_double_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_double")
 * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<double>  __pyx_convert_vector_from_py_double(PyObject *__pyx_v_o) {
  std::vector<double>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<double>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_item); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((double)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_double")
 * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

static std::unordered_map<std::string,std::vector<double> >  __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_d = 0;
  std::unordered_map<std::string,std::vector<double> >  __pyx_v_m;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  std::unordered_map<std::string,std::vector<double> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  std::vector<double>  __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___", 0);

  /* "map.from_py":175
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(object o) except *:
 *     cdef dict d = o             # <<<<<<<<<<<<<<
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(2, 175, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_o;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.from_py":177
 *     cdef dict d = o
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():             # <<<<<<<<<<<<<<
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(2, 177, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(2, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "map.from_py":178
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))             # <<<<<<<<<<<<<<
 *     return m
 * 
 */
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_t_9 = __pyx_convert_vector_from_py_double(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_v_m.insert(std::pair<std::string,std::vector<double> > (((std::string)__pyx_t_8), ((std::vector<double> )__pyx_t_9)));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "map.from_py":179
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  /* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_double_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(const std::vector<std::vector<double> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_vector_to_py_double((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(std::unordered_map<std::string,std::vector<std::vector<double> > >  const &__pyx_v_s) {
  PyObject *__pyx_v_o = NULL;
  std::unordered_map<std::string,std::vector<std::vector<double> > > ::value_type const *__pyx_v_key_value;
  std::unordered_map<std::string,std::vector<std::vector<double> > > ::const_iterator __pyx_v_iter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___", 0);

  /* "map.to_py":202
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(const map[X,Y]& s):
 *     o = {}             # <<<<<<<<<<<<<<
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_o = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.to_py":204
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()             # <<<<<<<<<<<<<<
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 */
  __pyx_v_iter = __pyx_v_s.begin();

  /* "map.to_py":205
 *     cdef const map[X,Y].value_type *key_value
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():             # <<<<<<<<<<<<<<
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0);
    if (!__pyx_t_2) break;

    /* "map.to_py":206
 *     cdef map[X,Y].const_iterator iter = s.begin()
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)             # <<<<<<<<<<<<<<
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 */
    __pyx_v_key_value = (&(*__pyx_v_iter));

    /* "map.to_py":207
 *     while iter != s.end():
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second             # <<<<<<<<<<<<<<
 *         cython.operator.preincrement(iter)
 *     return o
 */
    __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_double_3e___(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(2, 207, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "map.to_py":208
 *         key_value = &cython.operator.dereference(iter)
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
 *     return o
 * 
 */
    (void)((++__pyx_v_iter));
  }

  /* "map.to_py":209
 *         o[key_value.first] = key_value.second
 *         cython.operator.preincrement(iter)
 *     return o             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_o);
  __pyx_r = __pyx_v_o;
  goto __pyx_L0;

  /* "map.to_py":201
 * 
 * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(const map[X,Y]& s):             # <<<<<<<<<<<<<<
 *     o = {}
 *     cdef const map[X,Y].value_type *key_value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::vector<double> >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(PyObject *__pyx_v_o) {
  std::vector<std::vector<double> >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::vector<double> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::vector<double>  __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_vector_from_py_double(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::vector<double> )__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

static std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_d = 0;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_v_m;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  std::unordered_map<std::string,std::vector<std::vector<double> > >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::string __pyx_t_8;
  std::vector<std::vector<double> >  __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___", 0);

  /* "map.from_py":175
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(object o) except *:
 *     cdef dict d = o             # <<<<<<<<<<<<<<
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(2, 175, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_o;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "map.from_py":177
 *     cdef dict d = o
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():             # <<<<<<<<<<<<<<
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(2, 177, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(2, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "map.from_py":178
 *     cdef map[X,Y] m
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))             # <<<<<<<<<<<<<<
 *     return m
 * 
 */
    __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_t_9 = __pyx_convert_vector_from_py_std_3a__3a_vector_3c_double_3e___(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 178, __pyx_L1_error)
    __pyx_v_m.insert(std::pair<std::string,std::vector<std::vector<double> > > (((std::string)__pyx_t_8), ((std::vector<std::vector<double> > )__pyx_t_9)));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "map.from_py":179
 *     for key, value in d.iteritems():
 *         m.insert(pair[X,Y](<X>key, <Y>value))
 *     return m             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  /* "map.from_py":174
 * 
 * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___")
 * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef dict d = o
 *     cdef map[X,Y] m
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_vector_3c_std_3a__3a_vector_3c_double_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(const std::vector<std::vector<std::string> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(const std::vector<std::vector<std::vector<std::string> > >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::vector<std::string> >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(PyObject *__pyx_v_o) {
  std::vector<std::vector<std::string> >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::vector<std::string> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::vector<std::string>  __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::vector<std::string> )__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::vector<std::vector<std::vector<std::string> > >  __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(PyObject *__pyx_v_o) {
  std::vector<std::vector<std::vector<std::string> > >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::vector<std::vector<std::string> > >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::vector<std::vector<std::string> >  __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_string_3e___(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::vector<std::vector<std::string> > )__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_vector_3c_std_3a__3a_vector_3c_std_3a__3a_string_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::vector<long>  __pyx_convert_vector_from_py_long(PyObject *__pyx_v_o) {
  std::vector<long>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<long>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_long", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_long(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_v_item); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((long)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_long(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_long")
 * cdef vector[X] __pyx_convert_vector_from_py_long(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_long", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7trapeza_8strategy_11fx_strategy_cFXStrategy __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy;

static PyObject *__pyx_tp_new_7trapeza_8strategy_11fx_strategy_cFXStrategy(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)o);
  p->__pyx_vtab = __pyx_vtabptr_7trapeza_8strategy_11fx_strategy_cFXStrategy;
  new((void*)&(p->c_signals)) std::vector<std::vector<std::vector<std::string> > > ();
  new((void*)&(p->c_positions)) std::unordered_map<std::string,std::vector<std::vector<double> > > ();
  new((void*)&(p->c_merged_positions)) std::unordered_map<std::string,std::vector<double> > ();
  new((void*)&(p->c_total_balances)) std::vector<std::vector<double> > ();
  new((void*)&(p->c_merged_total_balances)) std::vector<double> ();
  new((void*)&(p->_c_signals_at_step_t)) std::unordered_map<long,std::vector<std::string> > ();
  new((void*)&(p->c_name)) std::string();
  p->c_accounts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->c_strategy_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->c_tick_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->c_strategy_func = Py_None; Py_INCREF(Py_None);
  p->c_tick_method = Py_None; Py_INCREF(Py_None);
  p->_c_init_accs_depots = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_c_accs_clocks = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7trapeza_8strategy_11fx_strategy_cFXStrategy(PyObject *o) {
  struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *p = (struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->c_signals);
  __Pyx_call_destructor(p->c_positions);
  __Pyx_call_destructor(p->c_merged_positions);
  __Pyx_call_destructor(p->c_total_balances);
  __Pyx_call_destructor(p->c_merged_total_balances);
  __Pyx_call_destructor(p->_c_signals_at_step_t);
  __Pyx_call_destructor(p->c_name);
  Py_CLEAR(p->c_accounts);
  Py_CLEAR(p->c_strategy_kwargs);
  Py_CLEAR(p->c_tick_kwargs);
  Py_CLEAR(p->c_strategy_func);
  Py_CLEAR(p->c_tick_method);
  Py_CLEAR(p->_c_init_accs_depots);
  Py_CLEAR(p->_c_accs_clocks);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7trapeza_8strategy_11fx_strategy_cFXStrategy(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *p = (struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)o;
  if (p->c_accounts) {
    e = (*v)(p->c_accounts, a); if (e) return e;
  }
  if (p->c_strategy_kwargs) {
    e = (*v)(p->c_strategy_kwargs, a); if (e) return e;
  }
  if (p->c_tick_kwargs) {
    e = (*v)(p->c_tick_kwargs, a); if (e) return e;
  }
  if (p->c_strategy_func) {
    e = (*v)(p->c_strategy_func, a); if (e) return e;
  }
  if (p->c_tick_method) {
    e = (*v)(p->c_tick_method, a); if (e) return e;
  }
  if (p->_c_init_accs_depots) {
    e = (*v)(p->_c_init_accs_depots, a); if (e) return e;
  }
  if (p->_c_accs_clocks) {
    e = (*v)(p->_c_accs_clocks, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7trapeza_8strategy_11fx_strategy_cFXStrategy(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *p = (struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *)o;
  tmp = ((PyObject*)p->c_accounts);
  p->c_accounts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->c_strategy_kwargs);
  p->c_strategy_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->c_tick_kwargs);
  p->c_tick_kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->c_strategy_func);
  p->c_strategy_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->c_tick_method);
  p->c_tick_method = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_c_init_accs_depots);
  p->_c_init_accs_depots = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_c_accs_clocks);
  p->_c_accs_clocks = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6c_name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_ignore_type_checking(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23_c_ignore_type_checking_1__get__(o);
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_accounts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_accounts(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_accounts_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_lookback(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_lookback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10c_lookback_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_suppress_ticking(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_suppress_ticking(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18c_suppress_ticking_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_kwargs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_kwargs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17c_strategy_kwargs_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_kwargs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_kwargs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_kwargs_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_func(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_func(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15c_strategy_func_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_method(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_method(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13c_tick_method_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_accs_depots(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_accs_depots(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19_c_init_accs_depots_5__del__(o);
  }
}

static PyObject *__pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_accs_clocks(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_1__get__(o);
}

static int __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_accs_clocks(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_3__set__(o, v);
  }
  else {
    return __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14_c_accs_clocks_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_7trapeza_8strategy_11fx_strategy_cFXStrategy[] = {
  {"c_init", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_3c_init, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_2c_init},
  {"_c_init_all_positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_5_c_init_all_positions, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_4_c_init_all_positions},
  {"_c_reset_storage", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_7_c_reset_storage, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_6_c_reset_storage},
  {"c_reset", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_9c_reset, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_8c_reset},
  {"self_parse_positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_11self_parse_positions, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_10self_parse_positions},
  {"self_parse_signals", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_13self_parse_signals, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_12self_parse_signals},
  {"self_parse_merged_positions", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_15self_parse_merged_positions, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_14self_parse_merged_positions},
  {"self_parse_total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_17self_parse_total_balances, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_16self_parse_total_balances},
  {"self_parse_merged_total_balances", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_19self_parse_merged_total_balances, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_18self_parse_merged_total_balances},
  {"self_parse_signals_at_step_t", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_21self_parse_signals_at_step_t, METH_NOARGS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_20self_parse_signals_at_step_t},
  {"positions_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_23positions_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_22positions_from_py},
  {"signals_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_25signals_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_24signals_from_py},
  {"merged_positions_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_27merged_positions_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_26merged_positions_from_py},
  {"total_balances_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_29total_balances_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_28total_balances_from_py},
  {"merged_total_balances_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_31merged_total_balances_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_30merged_total_balances_from_py},
  {"_signals_at_step_t_from_py", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_33_signals_at_step_t_from_py, METH_O, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_32_signals_at_step_t_from_py},
  {"c_wrap_evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_35c_wrap_evaluate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_34c_wrap_evaluate},
  {"c_add_signal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_37c_add_signal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_36c_add_signal},
  {"c_wrap_run", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_39c_wrap_run, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy_38c_wrap_run},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_41__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_43__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7trapeza_8strategy_11fx_strategy_cFXStrategy[] = {
  {(char *)"c_name", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_name, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_name, (char *)0, 0},
  {(char *)"_c_ignore_type_checking", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_ignore_type_checking, 0, (char *)0, 0},
  {(char *)"c_accounts", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_accounts, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_accounts, (char *)0, 0},
  {(char *)"c_lookback", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_lookback, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_lookback, (char *)0, 0},
  {(char *)"c_suppress_ticking", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_suppress_ticking, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_suppress_ticking, (char *)0, 0},
  {(char *)"c_strategy_kwargs", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_kwargs, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_kwargs, (char *)0, 0},
  {(char *)"c_tick_kwargs", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_kwargs, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_kwargs, (char *)0, 0},
  {(char *)"c_strategy_func", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_func, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_strategy_func, (char *)0, 0},
  {(char *)"c_tick_method", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_method, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_tick_method, (char *)0, 0},
  {(char *)"_c_init_accs_depots", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_accs_depots, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_accs_depots, (char *)0, 0},
  {(char *)"_c_accs_clocks", __pyx_getprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_accs_clocks, __pyx_setprop_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_accs_clocks, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy = {
  PyVarObject_HEAD_INIT(0, 0)
  "trapeza.strategy.fx_strategy.cFXStrategy", /*tp_name*/
  sizeof(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    This as a C++ implementation via cython and gets wrapped by FXStrategy class. This class tries to stay in C++ space\n    as long as possible to avoid unnecessary type casting to Python data types. Internal class storage is implemented\n    via C++ vectors and C++ unordered_map (comparable to Python's dict) and is only casted to Python data types when\n    calling class attributes of FXStrategy.\n    Please refer to the docstring of FXStrategy for detailed descriptions. Details might differ slightly, but the\n    overall logic idea is the same and this class gets wrapped by FXStrategy anyhow. This class should never be called\n    directly by the user.\n    ", /*tp_doc*/
  __pyx_tp_traverse_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_traverse*/
  __pyx_tp_clear_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7trapeza_8strategy_11fx_strategy_11cFXStrategy_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7trapeza_8strategy_11fx_strategy_cFXStrategy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"_c_tick_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7trapeza_8strategy_11fx_strategy_1_c_tick_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7trapeza_8strategy_11fx_strategy__c_tick_method},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_fx_strategy(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_fx_strategy},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "fx_strategy",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_AccountError, __pyx_k_AccountError, sizeof(__pyx_k_AccountError), 0, 0, 1, 1},
  {&__pyx_kp_u_Account_clocks_have_not_been_tic, __pyx_k_Account_clocks_have_not_been_tic, sizeof(__pyx_k_Account_clocks_have_not_been_tic), 0, 1, 0, 0},
  {&__pyx_kp_u_Account_has_to_inherit_from_trap, __pyx_k_Account_has_to_inherit_from_trap, sizeof(__pyx_k_Account_has_to_inherit_from_trap), 0, 1, 0, 0},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BaseAccount, __pyx_k_BaseAccount, sizeof(__pyx_k_BaseAccount), 0, 0, 1, 1},
  {&__pyx_n_s_BaseStrategy, __pyx_k_BaseStrategy, sizeof(__pyx_k_BaseStrategy), 0, 0, 1, 1},
  {&__pyx_kp_u_Data_does_not_contain_enough_tim, __pyx_k_Data_does_not_contain_enough_tim, sizeof(__pyx_k_Data_does_not_contain_enough_tim), 0, 1, 0, 0},
  {&__pyx_kp_s_Derived_from_BaseStrategy_class, __pyx_k_Derived_from_BaseStrategy_class, sizeof(__pyx_k_Derived_from_BaseStrategy_class), 0, 0, 1, 0},
  {&__pyx_n_s_FXStrategy, __pyx_k_FXStrategy, sizeof(__pyx_k_FXStrategy), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy___init, __pyx_k_FXStrategy___init, sizeof(__pyx_k_FXStrategy___init), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__accs_clocks, __pyx_k_FXStrategy__accs_clocks, sizeof(__pyx_k_FXStrategy__accs_clocks), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__check_parse_accounts, __pyx_k_FXStrategy__check_parse_accounts, sizeof(__pyx_k_FXStrategy__check_parse_accounts), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__ignore_type_checking, __pyx_k_FXStrategy__ignore_type_checking, sizeof(__pyx_k_FXStrategy__ignore_type_checking), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__init_accs_depots, __pyx_k_FXStrategy__init_accs_depots, sizeof(__pyx_k_FXStrategy__init_accs_depots), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__init_all_positions, __pyx_k_FXStrategy__init_all_positions, sizeof(__pyx_k_FXStrategy__init_all_positions), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__reset_storage, __pyx_k_FXStrategy__reset_storage, sizeof(__pyx_k_FXStrategy__reset_storage), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__signals_at_step_t, __pyx_k_FXStrategy__signals_at_step_t, sizeof(__pyx_k_FXStrategy__signals_at_step_t), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy__tick_method, __pyx_k_FXStrategy__tick_method, sizeof(__pyx_k_FXStrategy__tick_method), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_accounts, __pyx_k_FXStrategy_accounts, sizeof(__pyx_k_FXStrategy_accounts), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_add_signal, __pyx_k_FXStrategy_add_signal, sizeof(__pyx_k_FXStrategy_add_signal), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_evaluate, __pyx_k_FXStrategy_evaluate, sizeof(__pyx_k_FXStrategy_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_lookback, __pyx_k_FXStrategy_lookback, sizeof(__pyx_k_FXStrategy_lookback), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_merged_positions, __pyx_k_FXStrategy_merged_positions, sizeof(__pyx_k_FXStrategy_merged_positions), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_merged_total_balances, __pyx_k_FXStrategy_merged_total_balances, sizeof(__pyx_k_FXStrategy_merged_total_balances), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_name, __pyx_k_FXStrategy_name, sizeof(__pyx_k_FXStrategy_name), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_positions, __pyx_k_FXStrategy_positions, sizeof(__pyx_k_FXStrategy_positions), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_reset, __pyx_k_FXStrategy_reset, sizeof(__pyx_k_FXStrategy_reset), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_run, __pyx_k_FXStrategy_run, sizeof(__pyx_k_FXStrategy_run), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_signals, __pyx_k_FXStrategy_signals, sizeof(__pyx_k_FXStrategy_signals), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_strategy_func, __pyx_k_FXStrategy_strategy_func, sizeof(__pyx_k_FXStrategy_strategy_func), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_strategy_kwargs, __pyx_k_FXStrategy_strategy_kwargs, sizeof(__pyx_k_FXStrategy_strategy_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_suppress_ticking, __pyx_k_FXStrategy_suppress_ticking, sizeof(__pyx_k_FXStrategy_suppress_ticking), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_tick_kwargs, __pyx_k_FXStrategy_tick_kwargs, sizeof(__pyx_k_FXStrategy_tick_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_tick_method, __pyx_k_FXStrategy_tick_method, sizeof(__pyx_k_FXStrategy_tick_method), 0, 0, 1, 1},
  {&__pyx_n_s_FXStrategy_total_balances, __pyx_k_FXStrategy_total_balances, sizeof(__pyx_k_FXStrategy_total_balances), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x2f, __pyx_k_Incompatible_checksums_s_vs_0x2f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x2f), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_kp_u_Not_all_time_series_of_all_tuple, __pyx_k_Not_all_time_series_of_all_tuple, sizeof(__pyx_k_Not_all_time_series_of_all_tuple), 0, 1, 0, 0},
  {&__pyx_n_s_OperatingError, __pyx_k_OperatingError, sizeof(__pyx_k_OperatingError), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_ProtectedDict, __pyx_k_ProtectedDict, sizeof(__pyx_k_ProtectedDict), 0, 0, 1, 1},
  {&__pyx_n_s_ProtectedList, __pyx_k_ProtectedList, sizeof(__pyx_k_ProtectedList), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s__100, __pyx_k__100, sizeof(__pyx_k__100), 0, 0, 1, 1},
  {&__pyx_n_s_acc, __pyx_k_acc, sizeof(__pyx_k_acc), 0, 0, 1, 1},
  {&__pyx_kp_u_account_list_in_time_step_list_o, __pyx_k_account_list_in_time_step_list_o, sizeof(__pyx_k_account_list_in_time_step_list_o), 0, 1, 0, 0},
  {&__pyx_kp_u_account_setter, __pyx_k_account_setter, sizeof(__pyx_k_account_setter), 0, 1, 0, 0},
  {&__pyx_n_s_accounts, __pyx_k_accounts, sizeof(__pyx_k_accounts), 0, 0, 1, 1},
  {&__pyx_n_s_accs_clocks, __pyx_k_accs_clocks, sizeof(__pyx_k_accs_clocks), 0, 0, 1, 1},
  {&__pyx_kp_u_accs_clocks_setter, __pyx_k_accs_clocks_setter, sizeof(__pyx_k_accs_clocks_setter), 0, 1, 0, 0},
  {&__pyx_kp_u_accs_clocks_setter_list_must_co, __pyx_k_accs_clocks_setter_list_must_co, sizeof(__pyx_k_accs_clocks_setter_list_must_co), 0, 1, 0, 0},
  {&__pyx_n_s_add_signal, __pyx_k_add_signal, sizeof(__pyx_k_add_signal), 0, 0, 1, 1},
  {&__pyx_n_s_all_keys, __pyx_k_all_keys, sizeof(__pyx_k_all_keys), 0, 0, 1, 1},
  {&__pyx_n_s_append_to_results, __pyx_k_append_to_results, sizeof(__pyx_k_append_to_results), 0, 0, 1, 1},
  {&__pyx_n_s_cFXStrategy, __pyx_k_cFXStrategy, sizeof(__pyx_k_cFXStrategy), 0, 0, 1, 1},
  {&__pyx_n_s_c_accounts, __pyx_k_c_accounts, sizeof(__pyx_k_c_accounts), 0, 0, 1, 1},
  {&__pyx_n_s_c_accs_clocks, __pyx_k_c_accs_clocks, sizeof(__pyx_k_c_accs_clocks), 0, 0, 1, 1},
  {&__pyx_n_s_c_add_signal, __pyx_k_c_add_signal, sizeof(__pyx_k_c_add_signal), 0, 0, 1, 1},
  {&__pyx_n_s_c_clock, __pyx_k_c_clock, sizeof(__pyx_k_c_clock), 0, 0, 1, 1},
  {&__pyx_n_s_c_ignore_type_checking, __pyx_k_c_ignore_type_checking, sizeof(__pyx_k_c_ignore_type_checking), 0, 0, 1, 1},
  {&__pyx_n_s_c_init, __pyx_k_c_init, sizeof(__pyx_k_c_init), 0, 0, 1, 1},
  {&__pyx_n_s_c_init_accs_depots, __pyx_k_c_init_accs_depots, sizeof(__pyx_k_c_init_accs_depots), 0, 0, 1, 1},
  {&__pyx_n_s_c_init_all_positions, __pyx_k_c_init_all_positions, sizeof(__pyx_k_c_init_all_positions), 0, 0, 1, 1},
  {&__pyx_n_s_c_lookback, __pyx_k_c_lookback, sizeof(__pyx_k_c_lookback), 0, 0, 1, 1},
  {&__pyx_n_s_c_name, __pyx_k_c_name, sizeof(__pyx_k_c_name), 0, 0, 1, 1},
  {&__pyx_n_s_c_position, __pyx_k_c_position, sizeof(__pyx_k_c_position), 0, 0, 1, 1},
  {&__pyx_n_s_c_reset, __pyx_k_c_reset, sizeof(__pyx_k_c_reset), 0, 0, 1, 1},
  {&__pyx_n_s_c_reset_storage, __pyx_k_c_reset_storage, sizeof(__pyx_k_c_reset_storage), 0, 0, 1, 1},
  {&__pyx_n_s_c_strategy_func, __pyx_k_c_strategy_func, sizeof(__pyx_k_c_strategy_func), 0, 0, 1, 1},
  {&__pyx_n_s_c_strategy_kwargs, __pyx_k_c_strategy_kwargs, sizeof(__pyx_k_c_strategy_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_c_suppress_ticking, __pyx_k_c_suppress_ticking, sizeof(__pyx_k_c_suppress_ticking), 0, 0, 1, 1},
  {&__pyx_n_s_c_tick, __pyx_k_c_tick, sizeof(__pyx_k_c_tick), 0, 0, 1, 1},
  {&__pyx_n_s_c_tick_kwargs, __pyx_k_c_tick_kwargs, sizeof(__pyx_k_c_tick_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_c_tick_method, __pyx_k_c_tick_method, sizeof(__pyx_k_c_tick_method), 0, 0, 1, 1},
  {&__pyx_n_s_c_tick_method_2, __pyx_k_c_tick_method_2, sizeof(__pyx_k_c_tick_method_2), 0, 0, 1, 1},
  {&__pyx_n_s_c_total_balance, __pyx_k_c_total_balance, sizeof(__pyx_k_c_total_balance), 0, 0, 1, 1},
  {&__pyx_n_s_c_wrap_evaluate, __pyx_k_c_wrap_evaluate, sizeof(__pyx_k_c_wrap_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_c_wrap_run, __pyx_k_c_wrap_run, sizeof(__pyx_k_c_wrap_run), 0, 0, 1, 1},
  {&__pyx_n_s_callable, __pyx_k_callable, sizeof(__pyx_k_callable), 0, 0, 1, 1},
  {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  {&__pyx_n_s_check_parse_accounts, __pyx_k_check_parse_accounts, sizeof(__pyx_k_check_parse_accounts), 0, 0, 1, 1},
  {&__pyx_n_s_check_types, __pyx_k_check_types, sizeof(__pyx_k_check_types), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_frame, __pyx_k_data_frame, sizeof(__pyx_k_data_frame), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_deleter, __pyx_k_deleter, sizeof(__pyx_k_deleter), 0, 0, 1, 1},
  {&__pyx_n_s_depot, __pyx_k_depot, sizeof(__pyx_k_depot), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_n_s_exchange_rates, __pyx_k_exchange_rates, sizeof(__pyx_k_exchange_rates), 0, 0, 1, 1},
  {&__pyx_kp_u_float_value_in_list_of_merged_to, __pyx_k_float_value_in_list_of_merged_to, sizeof(__pyx_k_float_value_in_list_of_merged_to), 0, 1, 0, 0},
  {&__pyx_kp_u_float_value_in_time_step_list_as, __pyx_k_float_value_in_time_step_list_as, sizeof(__pyx_k_float_value_in_time_step_list_as), 0, 1, 0, 0},
  {&__pyx_kp_u_float_value_in_time_step_list_of, __pyx_k_float_value_in_time_step_list_of, sizeof(__pyx_k_float_value_in_time_step_list_of), 0, 1, 0, 0},
  {&__pyx_kp_u_float_value_in_value_list_of_mer, __pyx_k_float_value_in_value_list_of_mer, sizeof(__pyx_k_float_value_in_value_list_of_mer), 0, 1, 0, 0},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_ignore_type_checking, __pyx_k_ignore_type_checking, sizeof(__pyx_k_ignore_type_checking), 0, 0, 1, 1},
  {&__pyx_n_s_ignore_type_checking_2, __pyx_k_ignore_type_checking_2, sizeof(__pyx_k_ignore_type_checking_2), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_accs_depots, __pyx_k_init_accs_depots, sizeof(__pyx_k_init_accs_depots), 0, 0, 1, 1},
  {&__pyx_kp_u_init_accs_depots_setter, __pyx_k_init_accs_depots_setter, sizeof(__pyx_k_init_accs_depots_setter), 0, 1, 0, 0},
  {&__pyx_kp_u_init_accs_depots_setter_list_mu, __pyx_k_init_accs_depots_setter_list_mu, sizeof(__pyx_k_init_accs_depots_setter_list_mu), 0, 1, 0, 0},
  {&__pyx_n_s_init_all_positions, __pyx_k_init_all_positions, sizeof(__pyx_k_init_all_positions), 0, 0, 1, 1},
  {&__pyx_n_s_inp, __pyx_k_inp, sizeof(__pyx_k_inp), 0, 0, 1, 1},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_n_s_intersection, __pyx_k_intersection, sizeof(__pyx_k_intersection), 0, 0, 1, 1},
  {&__pyx_n_s_intersection_param_names, __pyx_k_intersection_param_names, sizeof(__pyx_k_intersection_param_names), 0, 0, 1, 1},
  {&__pyx_n_u_is_order_manager_monkey_patch, __pyx_k_is_order_manager_monkey_patch, sizeof(__pyx_k_is_order_manager_monkey_patch), 0, 1, 0, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_kp_u_key_in__signals_at_step_t_setter, __pyx_k_key_in__signals_at_step_t_setter, sizeof(__pyx_k_key_in__signals_at_step_t_setter), 0, 1, 0, 0},
  {&__pyx_kp_u_key_in_merged_positions_setter_d, __pyx_k_key_in_merged_positions_setter_d, sizeof(__pyx_k_key_in_merged_positions_setter_d), 0, 1, 0, 0},
  {&__pyx_kp_u_key_in_position_setter_dict, __pyx_k_key_in_position_setter_dict, sizeof(__pyx_k_key_in_position_setter_dict), 0, 1, 0, 0},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_kp_u_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 1, 0, 0},
  {&__pyx_n_s_kwargs_2, __pyx_k_kwargs_2, sizeof(__pyx_k_kwargs_2), 0, 0, 1, 1},
  {&__pyx_n_s_len_data, __pyx_k_len_data, sizeof(__pyx_k_len_data), 0, 0, 1, 1},
  {&__pyx_kp_u_list_as_value_in__signals_at_ste, __pyx_k_list_as_value_in__signals_at_ste, sizeof(__pyx_k_list_as_value_in__signals_at_ste), 0, 1, 0, 0},
  {&__pyx_n_s_lookback, __pyx_k_lookback, sizeof(__pyx_k_lookback), 0, 0, 1, 1},
  {&__pyx_n_u_lookback, __pyx_k_lookback, sizeof(__pyx_k_lookback), 0, 1, 0, 1},
  {&__pyx_kp_u_lookback_setter, __pyx_k_lookback_setter, sizeof(__pyx_k_lookback_setter), 0, 1, 0, 0},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_merged_positions, __pyx_k_merged_positions, sizeof(__pyx_k_merged_positions), 0, 0, 1, 1},
  {&__pyx_n_s_merged_positions_from_py, __pyx_k_merged_positions_from_py, sizeof(__pyx_k_merged_positions_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_merged_positions_setter, __pyx_k_merged_positions_setter, sizeof(__pyx_k_merged_positions_setter), 0, 1, 0, 0},
  {&__pyx_n_s_merged_total_balances, __pyx_k_merged_total_balances, sizeof(__pyx_k_merged_total_balances), 0, 0, 1, 1},
  {&__pyx_n_s_merged_total_balances_from_py, __pyx_k_merged_total_balances_from_py, sizeof(__pyx_k_merged_total_balances_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_merged_total_balances_setter, __pyx_k_merged_total_balances_setter, sizeof(__pyx_k_merged_total_balances_setter), 0, 1, 0, 0},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_u_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 1, 0, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_kp_u_name_setter, __pyx_k_name_setter, sizeof(__pyx_k_name_setter), 0, 1, 0, 0},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_kp_u_param_strategy_func_and_param_ti, __pyx_k_param_strategy_func_and_param_ti, sizeof(__pyx_k_param_strategy_func_and_param_ti), 0, 1, 0, 0},
  {&__pyx_n_s_parameters, __pyx_k_parameters, sizeof(__pyx_k_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
  {&__pyx_n_s_position_from_py, __pyx_k_position_from_py, sizeof(__pyx_k_position_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_position_setter, __pyx_k_position_setter, sizeof(__pyx_k_position_setter), 0, 1, 0, 0},
  {&__pyx_n_s_positions, __pyx_k_positions, sizeof(__pyx_k_positions), 0, 0, 1, 1},
  {&__pyx_n_s_positions_from_py, __pyx_k_positions_from_py, sizeof(__pyx_k_positions_from_py), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_price_data, __pyx_k_price_data, sizeof(__pyx_k_price_data), 0, 0, 1, 1},
  {&__pyx_n_u_price_data, __pyx_k_price_data, sizeof(__pyx_k_price_data), 0, 1, 0, 1},
  {&__pyx_n_u_price_data_key, __pyx_k_price_data_key, sizeof(__pyx_k_price_data_key), 0, 1, 0, 1},
  {&__pyx_n_u_price_data_key_tuple_0, __pyx_k_price_data_key_tuple_0, sizeof(__pyx_k_price_data_key_tuple_0), 0, 1, 0, 1},
  {&__pyx_n_u_price_data_key_tuple_1, __pyx_k_price_data_key_tuple_1, sizeof(__pyx_k_price_data_key_tuple_1), 0, 1, 0, 1},
  {&__pyx_n_u_price_data_value, __pyx_k_price_data_value, sizeof(__pyx_k_price_data_value), 0, 1, 0, 1},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_cFXStrategy, __pyx_k_pyx_unpickle_cFXStrategy, sizeof(__pyx_k_pyx_unpickle_cFXStrategy), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reference_currency, __pyx_k_reference_currency, sizeof(__pyx_k_reference_currency), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_reset_2, __pyx_k_reset_2, sizeof(__pyx_k_reset_2), 0, 0, 1, 1},
  {&__pyx_n_s_reset_storage, __pyx_k_reset_storage, sizeof(__pyx_k_reset_storage), 0, 0, 1, 1},
  {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_merged_positions, __pyx_k_self_parse_merged_positions, sizeof(__pyx_k_self_parse_merged_positions), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_merged_total_balances, __pyx_k_self_parse_merged_total_balances, sizeof(__pyx_k_self_parse_merged_total_balances), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_positions, __pyx_k_self_parse_positions, sizeof(__pyx_k_self_parse_positions), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_signals, __pyx_k_self_parse_signals, sizeof(__pyx_k_self_parse_signals), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_signals_at_step_t, __pyx_k_self_parse_signals_at_step_t, sizeof(__pyx_k_self_parse_signals_at_step_t), 0, 0, 1, 1},
  {&__pyx_n_s_self_parse_total_balances, __pyx_k_self_parse_total_balances, sizeof(__pyx_k_self_parse_total_balances), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_setter, __pyx_k_setter, sizeof(__pyx_k_setter), 0, 0, 1, 1},
  {&__pyx_n_s_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 0, 1, 1},
  {&__pyx_n_u_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 1, 0, 1},
  {&__pyx_kp_u_signal_of_account_in_signals_set, __pyx_k_signal_of_account_in_signals_set, sizeof(__pyx_k_signal_of_account_in_signals_set), 0, 1, 0, 0},
  {&__pyx_n_s_signals, __pyx_k_signals, sizeof(__pyx_k_signals), 0, 0, 1, 1},
  {&__pyx_n_s_signals_at_step_t, __pyx_k_signals_at_step_t, sizeof(__pyx_k_signals_at_step_t), 0, 0, 1, 1},
  {&__pyx_n_s_signals_at_step_t_from_py, __pyx_k_signals_at_step_t_from_py, sizeof(__pyx_k_signals_at_step_t_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_signals_at_step_t_setter, __pyx_k_signals_at_step_t_setter, sizeof(__pyx_k_signals_at_step_t_setter), 0, 1, 0, 0},
  {&__pyx_n_s_signals_from_py, __pyx_k_signals_from_py, sizeof(__pyx_k_signals_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_signals_setter, __pyx_k_signals_setter, sizeof(__pyx_k_signals_setter), 0, 1, 0, 0},
  {&__pyx_n_s_signature, __pyx_k_signature, sizeof(__pyx_k_signature), 0, 0, 1, 1},
  {&__pyx_n_s_strategy_func, __pyx_k_strategy_func, sizeof(__pyx_k_strategy_func), 0, 0, 1, 1},
  {&__pyx_n_u_strategy_func, __pyx_k_strategy_func, sizeof(__pyx_k_strategy_func), 0, 1, 0, 1},
  {&__pyx_kp_u_strategy_func_setter, __pyx_k_strategy_func_setter, sizeof(__pyx_k_strategy_func_setter), 0, 1, 0, 0},
  {&__pyx_n_s_strategy_kwargs, __pyx_k_strategy_kwargs, sizeof(__pyx_k_strategy_kwargs), 0, 0, 1, 1},
  {&__pyx_kp_u_strategy_kwargs_setter, __pyx_k_strategy_kwargs_setter, sizeof(__pyx_k_strategy_kwargs_setter), 0, 1, 0, 0},
  {&__pyx_n_s_strategy_param_names, __pyx_k_strategy_param_names, sizeof(__pyx_k_strategy_param_names), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_suppress_ticking, __pyx_k_suppress_ticking, sizeof(__pyx_k_suppress_ticking), 0, 0, 1, 1},
  {&__pyx_n_u_suppress_ticking, __pyx_k_suppress_ticking, sizeof(__pyx_k_suppress_ticking), 0, 1, 0, 1},
  {&__pyx_kp_u_suppress_ticking_setter, __pyx_k_suppress_ticking_setter, sizeof(__pyx_k_suppress_ticking_setter), 0, 1, 0, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_tick, __pyx_k_tick, sizeof(__pyx_k_tick), 0, 0, 1, 1},
  {&__pyx_n_s_tick_func, __pyx_k_tick_func, sizeof(__pyx_k_tick_func), 0, 0, 1, 1},
  {&__pyx_kp_u_tick_func_setter, __pyx_k_tick_func_setter, sizeof(__pyx_k_tick_func_setter), 0, 1, 0, 0},
  {&__pyx_n_s_tick_kwargs, __pyx_k_tick_kwargs, sizeof(__pyx_k_tick_kwargs), 0, 0, 1, 1},
  {&__pyx_kp_u_tick_kwargs_setter, __pyx_k_tick_kwargs_setter, sizeof(__pyx_k_tick_kwargs_setter), 0, 1, 0, 0},
  {&__pyx_n_s_tick_method, __pyx_k_tick_method, sizeof(__pyx_k_tick_method), 0, 0, 1, 1},
  {&__pyx_n_s_tick_method_2, __pyx_k_tick_method_2, sizeof(__pyx_k_tick_method_2), 0, 0, 1, 1},
  {&__pyx_n_s_tick_param_names, __pyx_k_tick_param_names, sizeof(__pyx_k_tick_param_names), 0, 0, 1, 1},
  {&__pyx_kp_u_time_step_list_in_value_of_posit, __pyx_k_time_step_list_in_value_of_posit, sizeof(__pyx_k_time_step_list_in_value_of_posit), 0, 1, 0, 0},
  {&__pyx_kp_u_time_step_list_of_signals_setter, __pyx_k_time_step_list_of_signals_setter, sizeof(__pyx_k_time_step_list_of_signals_setter), 0, 1, 0, 0},
  {&__pyx_kp_u_time_step_list_of_total_balances, __pyx_k_time_step_list_of_total_balances, sizeof(__pyx_k_time_step_list_of_total_balances), 0, 1, 0, 0},
  {&__pyx_n_s_total_balance, __pyx_k_total_balance, sizeof(__pyx_k_total_balance), 0, 0, 1, 1},
  {&__pyx_n_s_total_balances, __pyx_k_total_balances, sizeof(__pyx_k_total_balances), 0, 0, 1, 1},
  {&__pyx_n_s_total_balances_from_py, __pyx_k_total_balances_from_py, sizeof(__pyx_k_total_balances_from_py), 0, 0, 1, 1},
  {&__pyx_kp_u_total_balances_setter, __pyx_k_total_balances_setter, sizeof(__pyx_k_total_balances_setter), 0, 1, 0, 0},
  {&__pyx_n_s_tpz_exception, __pyx_k_tpz_exception, sizeof(__pyx_k_tpz_exception), 0, 0, 1, 1},
  {&__pyx_n_s_trapeza, __pyx_k_trapeza, sizeof(__pyx_k_trapeza), 0, 0, 1, 1},
  {&__pyx_n_s_trapeza_account_base_account, __pyx_k_trapeza_account_base_account, sizeof(__pyx_k_trapeza_account_base_account), 0, 0, 1, 1},
  {&__pyx_n_s_trapeza_strategy_base_strategy, __pyx_k_trapeza_strategy_base_strategy, sizeof(__pyx_k_trapeza_strategy_base_strategy), 0, 0, 1, 1},
  {&__pyx_n_s_trapeza_strategy_fx_strategy, __pyx_k_trapeza_strategy_fx_strategy, sizeof(__pyx_k_trapeza_strategy_fx_strategy), 0, 0, 1, 1},
  {&__pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_k_trapeza_strategy_fx_strategy_pyx, sizeof(__pyx_k_trapeza_strategy_fx_strategy_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_trapeza_utils, __pyx_k_trapeza_utils, sizeof(__pyx_k_trapeza_utils), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_kp_u_value_in_list_as_value_in__signa, __pyx_k_value_in_list_as_value_in__signa, sizeof(__pyx_k_value_in_list_as_value_in__signa), 0, 1, 0, 0},
  {&__pyx_kp_u_value_in_merged_positions_setter, __pyx_k_value_in_merged_positions_setter, sizeof(__pyx_k_value_in_merged_positions_setter), 0, 1, 0, 0},
  {&__pyx_kp_u_value_in_position_setter_dict, __pyx_k_value_in_position_setter_dict, sizeof(__pyx_k_value_in_position_setter_dict), 0, 1, 0, 0},
  {&__pyx_n_s_volume_data, __pyx_k_volume_data, sizeof(__pyx_k_volume_data), 0, 0, 1, 1},
  {&__pyx_n_u_volume_data, __pyx_k_volume_data, sizeof(__pyx_k_volume_data), 0, 1, 0, 1},
  {&__pyx_n_u_volume_data_key, __pyx_k_volume_data_key, sizeof(__pyx_k_volume_data_key), 0, 1, 0, 1},
  {&__pyx_n_u_volume_data_key_tuple_0, __pyx_k_volume_data_key_tuple_0, sizeof(__pyx_k_volume_data_key_tuple_0), 0, 1, 0, 1},
  {&__pyx_n_u_volume_data_key_tuple_1, __pyx_k_volume_data_key_tuple_1, sizeof(__pyx_k_volume_data_key_tuple_1), 0, 1, 0, 1},
  {&__pyx_n_u_volume_data_value, __pyx_k_volume_data_value, sizeof(__pyx_k_volume_data_value), 0, 1, 0, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 1144, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 31, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 37, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 488, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 488, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 523, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 1702, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 1904, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "trapeza/strategy/fx_strategy.pyx":2036
 *                 check_types([price_data[k][0]], [float], ['price_data_value'], self._c_ignore_type_checking)
 *                 if len(price_data[k]) != len_data:
 *                     raise IndexError('Not all time series of all tuple keys within supplied price data dict have the '             # <<<<<<<<<<<<<<
 *                                      'same length.')
 *             # >>volume data
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Not_all_time_series_of_all_tuple); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "trapeza/strategy/fx_strategy.pyx":1145
 * 
 *     @property
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return FXStrategy.name
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
  __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_name, 1145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 1145, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1152
 *         return self.c_name.decode()
 *     @name.setter
 *     def name(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set FXStrategy.name
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_name, 1152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 1152, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1161
 *         self.c_name = inp.encode()
 *     @name.deleter
 *     def name(self):             # <<<<<<<<<<<<<<
 *         del self.name
 * 
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_name, 1161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1161, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1165
 * 
 *     @property
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of accounts contained in FXStrategy.
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accounts, 1165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 1165, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1172
 *         return ProtectedList(self.c_accounts)
 *     @accounts.setter
 *     def accounts(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set list of accounts (use is not recommended, instead set proper list of accounts at __init__).
 */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accounts, 1172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 1172, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1183
 *         self.c_accounts = inp
 *     @accounts.deleter
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         del self.accounts
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accounts, 1183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 1183, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1187
 * 
 *     @property
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns FXStrategy.lookback. This denotes the historic lookback data, which is available at time step 0.
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_lookback, 1187, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 1187, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1195
 *         return self.c_lookback
 *     @lookback.setter
 *     def lookback(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new lookback
 */
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_lookback, 1195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 1195, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1204
 *         self.c_lookback = inp
 *     @lookback.deleter
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         del self.lookback
 * 
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_lookback, 1204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 1204, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1208
 * 
 *     @property
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns status if ticking of accounts is suppressed (=True) or if accounts are automatically ticked during
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_suppress_ticking, 1208, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 1208, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1216
 *         return self.c_suppress_ticking
 *     @suppress_ticking.setter
 *     def suppress_ticking(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new status whether to suppress automatic ticking (=True).
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_suppress_ticking, 1216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 1216, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1225
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         del self.suppress_ticking
 * 
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_suppress_ticking, 1225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 1225, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1229
 * 
 *     @property
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for strategy decision function. See docstring of FXStrategy class for further details.
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_kwargs, 1229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 1229, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1236
 *         return ProtectedDict(self.c_strategy_kwargs)
 *     @strategy_kwargs.setter
 *     def strategy_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for strategy decision function. See docstring of FXStrategy class for further details.
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_kwargs, 1236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 1236, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1245
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_strategy_kwargs
 * 
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_kwargs, 1245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 1245, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1249
 * 
 *     @property
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_kwargs, 1249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 1249, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1256
 *         return ProtectedDict(self.c_tick_kwargs)
 *     @tick_kwargs.setter
 *     def tick_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */
  __pyx_tuple__34 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_kwargs, 1256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 1256, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1265
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_tick_kwargs
 * 
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_kwargs, 1265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 1265, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1269
 * 
 *     @property
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns strategy decision function (as object).
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_func, 1269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 1269, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1276
 *         return self.c_strategy_func
 *     @strategy_func.setter
 *     def strategy_func(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new strategy decision function.
 */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_func, 1276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 1276, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1285
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         del self.strategy_func
 * 
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_strategy_func, 1285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 1285, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1289
 * 
 *     @property
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns (alternative) ticking method for accounts.
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_method, 1289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 1289, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1296
 *         return self.c_tick_method
 *     @tick_method.setter
 *     def tick_method(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new (alternative) ticking method for accounts.
 */
  __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_method, 1296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1296, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1305
 *         self.c_tick_method = inp
 *     @tick_method.deleter
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         del self.tick_method
 * 
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_method, 1305, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1305, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1309
 * 
 *     @property
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return initial depot states of all accounts contained in FXStrategy.
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_init_accs_depots, 1309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1309, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1316
 *         return ProtectedList(self._c_init_accs_depots)
 *     @_init_accs_depots.setter
 *     def _init_accs_depots(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new initial depot states of all accounts contained in FXStrategy.
 */
  __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_inp, __pyx_n_s_i); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_init_accs_depots, 1316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1316, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1330
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         del self._init_accs_depots
 * 
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_init_accs_depots, 1330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 1330, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1334
 * 
 *     @property
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of all accounts' clocks (current time steps per account).
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accs_clocks, 1334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 1334, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1341
 *         return ProtectedList(self._c_accs_clocks)
 *     @_accs_clocks.setter
 *     def _accs_clocks(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of all accounts' clocks (current time step per account)
 */
  __pyx_tuple__58 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_inp, __pyx_n_s_i); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accs_clocks, 1341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 1341, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1354
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         del self._accs_clocks
 * 
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_accs_clocks, 1354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 1354, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1359
 *     # protected
 *     @property
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.positions. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);
  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_positions, 1359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 1359, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1366
 *         return ProtectedDict(self.self_parse_positions())
 *     @positions.setter
 *     def positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of positions to self.positions. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__64 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_inp, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_positions, 1366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 1366, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1388
 *         self.position_from_py(inp)
 *     @positions.deleter
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         del self.positions
 * 
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 1388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_positions, 1388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 1388, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1392
 * 
 *     @property
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.merged_positions. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__68 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_positions, 1392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 1392, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1399
 *         return ProtectedDict(self.self_parse_merged_positions())
 *     @merged_positions.setter
 *     def merged_positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of merged_positions to self.merged_positions. See docstring of FXStrategy class for
 */
  __pyx_tuple__70 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_inp, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_positions, 1399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 1399, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1420
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         del self.merged_positions
 * 
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_positions, 1420, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1420, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1424
 * 
 *     @property
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_total_balances, 1424, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 1424, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1431
 *         return ProtectedList(self.self_parse_total_balances())
 *     @total_balances.setter
 *     def total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of total_balances to self.total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 1431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_total_balances, 1431, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 1431, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1446
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.total_balances
 * 
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 1446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_total_balances, 1446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 1446, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1450
 * 
 *     @property
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.merged_total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_total_balances, 1450, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 1450, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1457
 *         return ProtectedList(self.self_parse_merged_total_balances())
 *     @merged_total_balances.setter
 *     def merged_total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of merged_total_balances to self.merged_total_balances. See docstring of FXStrategy class for
 */
  __pyx_tuple__82 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_total_balances, 1457, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 1457, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1470
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.merged_total_balances
 * 
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_merged_total_balances, 1470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 1470, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1474
 * 
 *     @property
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.signals. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 1474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals, 1474, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 1474, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1481
 *         return ProtectedList(self.self_parse_signals())
 *     @signals.setter
 *     def signals(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of signals to self.signals. See docstring of FXStrategy class for further information.
 */
  __pyx_tuple__88 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals, 1481, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 1481, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1498
 *         self.signals_from_py(inp)
 *     @signals.deleter
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         del self.signals
 * 
 */
  __pyx_tuple__90 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);
  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals, 1498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 1498, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1502
 * 
 *     @property
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self._signals_at_step_t.
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals_at_step_t, 1502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 1502, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1513
 *         return ProtectedDict(self.self_parse_signals_at_step_t())
 *     @_signals_at_step_t.setter
 *     def _signals_at_step_t(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Sets new dict of _signals_at_step_t to self._signals_at_step_t.
 */
  __pyx_tuple__94 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals_at_step_t, 1513, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 1513, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1535
 *         self._signals_at_step_t_from_py(inp)
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         del self._signals_at_step_t
 * 
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);
  __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_signals_at_step_t, 1535, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 1535, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1539
 * 
 *     @property
 *     def _ignore_type_checking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns current status whether types are checked (=False) at every method call or if checks are ignored (=True).
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);
  __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_ignore_type_checking_2, 1539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 1539, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1549
 * 
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,             # <<<<<<<<<<<<<<
 *                  ignore_type_checking=False, **kwargs):
 *         """
 */
  __pyx_tuple__101 = PyTuple_Pack(25, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_accounts, __pyx_n_s_strategy_func, __pyx_n_s_lookback, __pyx_n_s_tick_func, __pyx_n_s_suppress_ticking, __pyx_n_s_ignore_type_checking, __pyx_n_s_kwargs_2, __pyx_n_s_tick_method, __pyx_n_s_strategy_kwargs, __pyx_n_s_tick_kwargs, __pyx_n_s_strategy_param_names, __pyx_n_s_tick_param_names, __pyx_n_s_intersection_param_names, __pyx_n_s_k, __pyx_n_s__100, __pyx_n_s_k, __pyx_n_s__100, __pyx_n_s_k, __pyx_n_s__100, __pyx_n_s_k, __pyx_n_s__100, __pyx_n_s_k, __pyx_n_s_k); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(8, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_init, 1549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __pyx_tuple__103 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "trapeza/strategy/fx_strategy.pyx":1705
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)
 * 
 *     def _check_parse_accounts(self, accounts):             # <<<<<<<<<<<<<<
 *         """
 *         Checks if accounts (or account) are derived from trapeza.account.base_account.BaseAccount and
 */
  __pyx_tuple__104 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_accounts, __pyx_n_s_acc, __pyx_n_s_e); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);
  __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_check_parse_accounts, 1705, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 1705, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1730
 *             raise e
 * 
 *     def _init_all_positions(self, all_keys):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes positions (self.depot_position and self.depot_composite_positions)
 */
  __pyx_tuple__106 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_all_keys); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 1730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_init_all_positions, 1730, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 1730, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1740
 *         self._c_init_accs_depots(list(all_keys))
 * 
 *     def _reset_storage(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage (before self.run() is called):
 */
  __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_reset_storage, 1740, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 1740, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1749
 *         self._c_reset_storage()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage of FXStrategy and storage of accounts. Restores account depot status to the same
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_reset_2, 1749, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1749, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1760
 *         self.c_reset()
 * 
 *     def _tick_method(self, dict data):             # <<<<<<<<<<<<<<
 *         """
 *         Default ticking method if self.suppress_ticking=False and None passed to self.tick_func at
 */
  __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_tick_method_2, 1760, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1760, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1793
 *         _c_tick_method(self, data)
 * 
 *     def evaluate(self, dict data_frame, str reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluates accounts regarding position sizes and total balances (expressed in reference currency), as well as
 */
  __pyx_tuple__114 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data_frame, __pyx_n_s_reference_currency, __pyx_n_s_append_to_results); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_evaluate, 1793, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1793, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1865
 *         return self.c_wrap_evaluate(data_frame, reference_currency.encode(), append_to_results)
 * 
 *     def add_signal(self, acc, str signal):             # <<<<<<<<<<<<<<
 *         """
 *         Adds signal of specific account for current time step t, which is then automatically processed and appended to
 */
  __pyx_tuple__116 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_acc, __pyx_n_s_signal, __pyx_n_s_i); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_add_signal, 1865, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 1865, __pyx_L1_error)

  /* "trapeza/strategy/fx_strategy.pyx":1909
 *         self.c_add_signal(i, signal.encode())
 * 
 *     def run(self, dict price_data, str reference_currency, volume_data=None):             # <<<<<<<<<<<<<<
 *         """
 *         Runs strategy_func with supplied data. Data is fed in via looping through every time step of data.
 */
  __pyx_tuple__118 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_price_data, __pyx_n_s_reference_currency, __pyx_n_s_volume_data, __pyx_n_s_len_data, __pyx_n_s_k); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_trapeza_strategy_fx_strategy_pyx, __pyx_n_s_run, 1909, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __pyx_tuple__120 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);

  /* "(tree fragment)":1
 * def __pyx_unpickle_cFXStrategy(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__121 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_cFXStrategy, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_50309536 = PyInt_FromLong(50309536L); if (unlikely(!__pyx_int_50309536)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("_c_tick_method", (void (*)(void))__pyx_f_7trapeza_8strategy_11fx_strategy__c_tick_method, "short (PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_7trapeza_8strategy_11fx_strategy_cFXStrategy = &__pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_init = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::string, PyObject *, PyObject *, long, PyObject *, bool, bool, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_init;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy._c_init_all_positions = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_init_all_positions;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy._c_reset_storage = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__c_reset_storage;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_reset = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_reset;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.parse_positions = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::unordered_map<std::string,std::vector<std::vector<double> > > ))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_positions;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.parse_signals = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<std::vector<std::vector<std::string> > > ))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_signals;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.parse_merged_positions = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::unordered_map<std::string,std::vector<double> > ))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_positions;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.parse_total_balances = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<std::vector<double> > ))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_total_balances;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.parse_merged_total_balances = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, std::vector<double> ))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_parse_merged_total_balances;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_positions = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_positions;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_signals = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_merged_positions = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_positions;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_total_balances = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_total_balances;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_merged_total_balances = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_merged_total_balances;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.self_parse_signals_at_step_t = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_self_parse_signals_at_step_t;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.positions_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_positions_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.signals_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_signals_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.merged_positions_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_positions_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.total_balances_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_total_balances_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.merged_total_balances_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_merged_total_balances_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy._signals_at_step_t_from_py = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy__signals_at_step_t_from_py;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_wrap_evaluate = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_evaluate;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_evaluate = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, bool, std::vector<std::vector<std::string> >  *, std::vector<std::unordered_map<std::string,double> >  *, std::vector<double>  *))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_evaluate;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_add_signal = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, long, std::string, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_add_signal;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_run = (short (*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, long, std::vector<std::vector<std::vector<std::string> > >  *, std::unordered_map<std::string,std::vector<std::vector<double> > >  *, std::unordered_map<std::string,std::vector<double> >  *, std::vector<std::vector<double> >  *, std::vector<double>  *))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_run;
  __pyx_vtable_7trapeza_8strategy_11fx_strategy_cFXStrategy.c_wrap_run = (PyObject *(*)(struct __pyx_obj_7trapeza_8strategy_11fx_strategy_cFXStrategy *, PyObject *, std::string, PyObject *, long, int __pyx_skip_dispatch))__pyx_f_7trapeza_8strategy_11fx_strategy_11cFXStrategy_c_wrap_run;
  if (PyType_Ready(&__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy.tp_dictoffset && __pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 43, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__.doc = __pyx_doc_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7trapeza_8strategy_11fx_strategy_11cFXStrategy___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy.tp_dict, __pyx_vtabptr_7trapeza_8strategy_11fx_strategy_cFXStrategy) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cFXStrategy, (PyObject *)&__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy = &__pyx_type_7trapeza_8strategy_11fx_strategy_cFXStrategy;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __pyx_t_1 = PyImport_ImportModule("trapeza.arithmetics.arithmetics"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "c_precision_add", (void **)&__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_add, "__pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "c_precision_subtract", (void **)&__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_subtract, "__pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "c_precision_multiply", (void **)&__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_multiply, "__pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "c_precision_divide", (void **)&__pyx_vp_7trapeza_11arithmetics_11arithmetics_c_precision_divide, "__pyx_t_7trapeza_11arithmetics_11arithmetics_c_precision_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initfx_strategy(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initfx_strategy(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_fx_strategy(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_fx_strategy(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_fx_strategy(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'fx_strategy' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_fx_strategy(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("fx_strategy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_trapeza__strategy__fx_strategy) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "trapeza.strategy.fx_strategy")) {
      if (unlikely(PyDict_SetItemString(modules, "trapeza.strategy.fx_strategy", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_type_import_code();
  if (unlikely(__Pyx_modinit_variable_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "trapeza/strategy/fx_strategy.pyx":1
 * import inspect             # <<<<<<<<<<<<<<
 * import itertools
 * 
 */
  __pyx_t_1 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, 0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_inspect, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":2
 * import inspect
 * import itertools             # <<<<<<<<<<<<<<
 * 
 * import cython
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_itertools, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_itertools, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":6
 * import cython
 * 
 * from trapeza.account.base_account import BaseAccount             # <<<<<<<<<<<<<<
 * from trapeza.strategy.base_strategy import BaseStrategy
 * from trapeza.utils import check_types, ProtectedDict, ProtectedList
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_BaseAccount);
  __Pyx_GIVEREF(__pyx_n_s_BaseAccount);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BaseAccount);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_trapeza_account_base_account, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BaseAccount); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseAccount, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":7
 * 
 * from trapeza.account.base_account import BaseAccount
 * from trapeza.strategy.base_strategy import BaseStrategy             # <<<<<<<<<<<<<<
 * from trapeza.utils import check_types, ProtectedDict, ProtectedList
 * from trapeza import exception as tpz_exception
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_BaseStrategy);
  __Pyx_GIVEREF(__pyx_n_s_BaseStrategy);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_BaseStrategy);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_trapeza_strategy_base_strategy, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BaseStrategy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseStrategy, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":8
 * from trapeza.account.base_account import BaseAccount
 * from trapeza.strategy.base_strategy import BaseStrategy
 * from trapeza.utils import check_types, ProtectedDict, ProtectedList             # <<<<<<<<<<<<<<
 * from trapeza import exception as tpz_exception
 * 
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_check_types);
  __Pyx_GIVEREF(__pyx_n_s_check_types);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_check_types);
  __Pyx_INCREF(__pyx_n_s_ProtectedDict);
  __Pyx_GIVEREF(__pyx_n_s_ProtectedDict);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ProtectedDict);
  __Pyx_INCREF(__pyx_n_s_ProtectedList);
  __Pyx_GIVEREF(__pyx_n_s_ProtectedList);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_ProtectedList);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_trapeza_utils, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_check_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_types, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ProtectedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProtectedDict, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ProtectedList); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProtectedList, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":9
 * from trapeza.strategy.base_strategy import BaseStrategy
 * from trapeza.utils import check_types, ProtectedDict, ProtectedList
 * from trapeza import exception as tpz_exception             # <<<<<<<<<<<<<<
 * 
 * from trapeza.arithmetics.arithmetics cimport c_precision_add
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exception);
  __Pyx_GIVEREF(__pyx_n_s_exception);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exception);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_trapeza, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tpz_exception, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":778
 * 
 * # noinspection PyAbstractClass,PyAttributeOutsideInit,PyUnresolvedReferences,PyTypeChecker
 * class FXStrategy(cFXStrategy, BaseStrategy):             # <<<<<<<<<<<<<<
 *     """
 *     Derived from BaseStrategy class. This implementation is meant to be used with FXAccount (patched by
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BaseStrategy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7trapeza_8strategy_11fx_strategy_cFXStrategy));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_FXStrategy, __pyx_n_s_FXStrategy, (PyObject *) NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_kp_s_Derived_from_BaseStrategy_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "trapeza/strategy/fx_strategy.pyx":1145
 * 
 *     @property
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return FXStrategy.name
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_1name, 0, __pyx_n_s_FXStrategy_name, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1144
 *     """
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_t_6) < 0) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1151
 *         """
 *         return self.c_name.decode()
 *     @name.setter             # <<<<<<<<<<<<<<
 *     def name(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_name);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_name);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1152
 *         return self.c_name.decode()
 *     @name.setter
 *     def name(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set FXStrategy.name
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_3name, 0, __pyx_n_s_FXStrategy_name, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_t_6) < 0) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1160
 *         check_types([inp], [str], ['name setter'], self._c_ignore_type_checking)
 *         self.c_name = inp.encode()
 *     @name.deleter             # <<<<<<<<<<<<<<
 *     def name(self):
 *         del self.name
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_name);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_name);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1161
 *         self.c_name = inp.encode()
 *     @name.deleter
 *     def name(self):             # <<<<<<<<<<<<<<
 *         del self.name
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_5name, 0, __pyx_n_s_FXStrategy_name, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_t_6) < 0) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1165
 * 
 *     @property
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of accounts contained in FXStrategy.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_7accounts, 0, __pyx_n_s_FXStrategy_accounts, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1164
 *         del self.name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def accounts(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accounts, __pyx_t_5) < 0) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1171
 *         """
 *         return ProtectedList(self.c_accounts)
 *     @accounts.setter             # <<<<<<<<<<<<<<
 *     def accounts(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_accounts);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_accounts);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1172
 *         return ProtectedList(self.c_accounts)
 *     @accounts.setter
 *     def accounts(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set list of accounts (use is not recommended, instead set proper list of accounts at __init__).
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_9accounts, 0, __pyx_n_s_FXStrategy_accounts, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accounts, __pyx_t_5) < 0) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1182
 *             inp = self._check_parse_accounts(inp)
 *         self.c_accounts = inp
 *     @accounts.deleter             # <<<<<<<<<<<<<<
 *     def accounts(self):
 *         del self.accounts
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_accounts);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_accounts);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1183
 *         self.c_accounts = inp
 *     @accounts.deleter
 *     def accounts(self):             # <<<<<<<<<<<<<<
 *         del self.accounts
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_11accounts, 0, __pyx_n_s_FXStrategy_accounts, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accounts, __pyx_t_5) < 0) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1187
 * 
 *     @property
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns FXStrategy.lookback. This denotes the historic lookback data, which is available at time step 0.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_13lookback, 0, __pyx_n_s_FXStrategy_lookback, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1186
 *         del self.accounts
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def lookback(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_lookback, __pyx_t_6) < 0) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1194
 *         """
 *         return self.c_lookback
 *     @lookback.setter             # <<<<<<<<<<<<<<
 *     def lookback(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_lookback);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_lookback);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1195
 *         return self.c_lookback
 *     @lookback.setter
 *     def lookback(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new lookback
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_15lookback, 0, __pyx_n_s_FXStrategy_lookback, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_lookback, __pyx_t_6) < 0) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1203
 *         check_types([inp], [int], ['lookback setter'], self._c_ignore_type_checking)
 *         self.c_lookback = inp
 *     @lookback.deleter             # <<<<<<<<<<<<<<
 *     def lookback(self):
 *         del self.lookback
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_lookback);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_lookback);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1204
 *         self.c_lookback = inp
 *     @lookback.deleter
 *     def lookback(self):             # <<<<<<<<<<<<<<
 *         del self.lookback
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_17lookback, 0, __pyx_n_s_FXStrategy_lookback, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_lookback, __pyx_t_6) < 0) __PYX_ERR(0, 1204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1208
 * 
 *     @property
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns status if ticking of accounts is suppressed (=True) or if accounts are automatically ticked during
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_19suppress_ticking, 0, __pyx_n_s_FXStrategy_suppress_ticking, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1207
 *         del self.lookback
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suppress_ticking(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_suppress_ticking, __pyx_t_5) < 0) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1215
 *         """
 *         return self.c_suppress_ticking
 *     @suppress_ticking.setter             # <<<<<<<<<<<<<<
 *     def suppress_ticking(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_suppress_ticking);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_suppress_ticking);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1216
 *         return self.c_suppress_ticking
 *     @suppress_ticking.setter
 *     def suppress_ticking(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new status whether to suppress automatic ticking (=True).
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_21suppress_ticking, 0, __pyx_n_s_FXStrategy_suppress_ticking, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_suppress_ticking, __pyx_t_5) < 0) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1224
 *         check_types([inp], [bool], ['suppress_ticking setter'], self._c_ignore_type_checking)
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter             # <<<<<<<<<<<<<<
 *     def suppress_ticking(self):
 *         del self.suppress_ticking
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_suppress_ticking);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_suppress_ticking);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1225
 *         self.c_suppress_ticking = inp
 *     @suppress_ticking.deleter
 *     def suppress_ticking(self):             # <<<<<<<<<<<<<<
 *         del self.suppress_ticking
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_23suppress_ticking, 0, __pyx_n_s_FXStrategy_suppress_ticking, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_suppress_ticking, __pyx_t_5) < 0) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1229
 * 
 *     @property
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for strategy decision function. See docstring of FXStrategy class for further details.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_25strategy_kwargs, 0, __pyx_n_s_FXStrategy_strategy_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1228
 *         del self.suppress_ticking
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strategy_kwargs(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_kwargs, __pyx_t_6) < 0) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1235
 *         """
 *         return ProtectedDict(self.c_strategy_kwargs)
 *     @strategy_kwargs.setter             # <<<<<<<<<<<<<<
 *     def strategy_kwargs(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_strategy_kwargs);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_strategy_kwargs);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1236
 *         return ProtectedDict(self.c_strategy_kwargs)
 *     @strategy_kwargs.setter
 *     def strategy_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for strategy decision function. See docstring of FXStrategy class for further details.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_27strategy_kwargs, 0, __pyx_n_s_FXStrategy_strategy_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_kwargs, __pyx_t_6) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1244
 *         check_types([inp], [dict], ['strategy_kwargs setter'], self._c_ignore_type_checking)
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter             # <<<<<<<<<<<<<<
 *     def strategy_kwargs(self):
 *         del self.c_strategy_kwargs
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_strategy_kwargs);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_strategy_kwargs);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1245
 *         self.c_strategy_kwargs = inp
 *     @strategy_kwargs.deleter
 *     def strategy_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_strategy_kwargs
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_29strategy_kwargs, 0, __pyx_n_s_FXStrategy_strategy_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_kwargs, __pyx_t_6) < 0) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1249
 * 
 *     @property
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns kwargs for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_31tick_kwargs, 0, __pyx_n_s_FXStrategy_tick_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1248
 *         del self.c_strategy_kwargs
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tick_kwargs(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_kwargs, __pyx_t_5) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1255
 *         """
 *         return ProtectedDict(self.c_tick_kwargs)
 *     @tick_kwargs.setter             # <<<<<<<<<<<<<<
 *     def tick_kwargs(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_tick_kwargs);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_tick_kwargs);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1256
 *         return ProtectedDict(self.c_tick_kwargs)
 *     @tick_kwargs.setter
 *     def tick_kwargs(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set a new kwargs dict for (alternative) ticking method. See docstring of FXStrategy class for further details.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_33tick_kwargs, 0, __pyx_n_s_FXStrategy_tick_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_kwargs, __pyx_t_5) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1264
 *         check_types([inp], [dict], ['tick_kwargs setter'], self._c_ignore_type_checking)
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter             # <<<<<<<<<<<<<<
 *     def tick_kwargs(self):
 *         del self.c_tick_kwargs
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_tick_kwargs);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tick_kwargs);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1265
 *         self.c_tick_kwargs = inp
 *     @tick_kwargs.deleter
 *     def tick_kwargs(self):             # <<<<<<<<<<<<<<
 *         del self.c_tick_kwargs
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_35tick_kwargs, 0, __pyx_n_s_FXStrategy_tick_kwargs, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_kwargs, __pyx_t_5) < 0) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1269
 * 
 *     @property
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns strategy decision function (as object).
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_37strategy_func, 0, __pyx_n_s_FXStrategy_strategy_func, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1268
 *         del self.c_tick_kwargs
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def strategy_func(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_func, __pyx_t_6) < 0) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1275
 *         """
 *         return self.c_strategy_func
 *     @strategy_func.setter             # <<<<<<<<<<<<<<
 *     def strategy_func(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_strategy_func);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_strategy_func);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1276
 *         return self.c_strategy_func
 *     @strategy_func.setter
 *     def strategy_func(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new strategy decision function.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_39strategy_func, 0, __pyx_n_s_FXStrategy_strategy_func, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_func, __pyx_t_6) < 0) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1284
 *         check_types([inp], [callable], ['strategy_func setter'], self._c_ignore_type_checking)
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter             # <<<<<<<<<<<<<<
 *     def strategy_func(self):
 *         del self.strategy_func
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_strategy_func);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_strategy_func);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1285
 *         self.c_strategy_func = inp
 *     @strategy_func.deleter
 *     def strategy_func(self):             # <<<<<<<<<<<<<<
 *         del self.strategy_func
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_41strategy_func, 0, __pyx_n_s_FXStrategy_strategy_func, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_strategy_func, __pyx_t_6) < 0) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1289
 * 
 *     @property
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns (alternative) ticking method for accounts.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_43tick_method, 0, __pyx_n_s_FXStrategy_tick_method, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1288
 *         del self.strategy_func
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def tick_method(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_method, __pyx_t_5) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1295
 *         """
 *         return self.c_tick_method
 *     @tick_method.setter             # <<<<<<<<<<<<<<
 *     def tick_method(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_tick_method);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_tick_method);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1296
 *         return self.c_tick_method
 *     @tick_method.setter
 *     def tick_method(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new (alternative) ticking method for accounts.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_45tick_method, 0, __pyx_n_s_FXStrategy_tick_method, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_method, __pyx_t_5) < 0) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1304
 *         check_types([inp], [callable], ['tick_func setter'], self._c_ignore_type_checking)
 *         self.c_tick_method = inp
 *     @tick_method.deleter             # <<<<<<<<<<<<<<
 *     def tick_method(self):
 *         del self.tick_method
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_tick_method);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tick_method);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1305
 *         self.c_tick_method = inp
 *     @tick_method.deleter
 *     def tick_method(self):             # <<<<<<<<<<<<<<
 *         del self.tick_method
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_47tick_method, 0, __pyx_n_s_FXStrategy_tick_method, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_method, __pyx_t_5) < 0) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1309
 * 
 *     @property
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return initial depot states of all accounts contained in FXStrategy.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_49_init_accs_depots, 0, __pyx_n_s_FXStrategy__init_accs_depots, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1308
 *         del self.tick_method
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def _init_accs_depots(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init_accs_depots, __pyx_t_6) < 0) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1315
 *         """
 *         return ProtectedList(self._c_init_accs_depots)
 *     @_init_accs_depots.setter             # <<<<<<<<<<<<<<
 *     def _init_accs_depots(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_init_accs_depots);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_init_accs_depots);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1316
 *         return ProtectedList(self._c_init_accs_depots)
 *     @_init_accs_depots.setter
 *     def _init_accs_depots(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new initial depot states of all accounts contained in FXStrategy.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_51_init_accs_depots, 0, __pyx_n_s_FXStrategy__init_accs_depots, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init_accs_depots, __pyx_t_6) < 0) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1329
 *                             self._c_ignore_type_checking)
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter             # <<<<<<<<<<<<<<
 *     def _init_accs_depots(self):
 *         del self._init_accs_depots
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_init_accs_depots);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_init_accs_depots);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1330
 *         self._c_init_accs_depots = inp
 *     @_init_accs_depots.deleter
 *     def _init_accs_depots(self):             # <<<<<<<<<<<<<<
 *         del self._init_accs_depots
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_53_init_accs_depots, 0, __pyx_n_s_FXStrategy__init_accs_depots, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init_accs_depots, __pyx_t_6) < 0) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1334
 * 
 *     @property
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return list of all accounts' clocks (current time steps per account).
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_55_accs_clocks, 0, __pyx_n_s_FXStrategy__accs_clocks, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1333
 *         del self._init_accs_depots
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def _accs_clocks(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accs_clocks, __pyx_t_5) < 0) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1340
 *         """
 *         return ProtectedList(self._c_accs_clocks)
 *     @_accs_clocks.setter             # <<<<<<<<<<<<<<
 *     def _accs_clocks(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_accs_clocks);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_accs_clocks);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1341
 *         return ProtectedList(self._c_accs_clocks)
 *     @_accs_clocks.setter
 *     def _accs_clocks(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of all accounts' clocks (current time step per account)
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_57_accs_clocks, 0, __pyx_n_s_FXStrategy__accs_clocks, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accs_clocks, __pyx_t_5) < 0) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1353
 *                             self._c_ignore_type_checking)
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter             # <<<<<<<<<<<<<<
 *     def _accs_clocks(self):
 *         del self._accs_clocks
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_accs_clocks);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_accs_clocks);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1354
 *         self._c_accs_clocks = inp
 *     @_accs_clocks.deleter
 *     def _accs_clocks(self):             # <<<<<<<<<<<<<<
 *         del self._accs_clocks
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_59_accs_clocks, 0, __pyx_n_s_FXStrategy__accs_clocks, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_accs_clocks, __pyx_t_5) < 0) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1359
 *     # protected
 *     @property
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.positions. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_61positions, 0, __pyx_n_s_FXStrategy_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1358
 * 
 *     # protected
 *     @property             # <<<<<<<<<<<<<<
 *     def positions(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_positions, __pyx_t_6) < 0) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1365
 *         """
 *         return ProtectedDict(self.self_parse_positions())
 *     @positions.setter             # <<<<<<<<<<<<<<
 *     def positions(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_positions);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_positions);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1366
 *         return ProtectedDict(self.self_parse_positions())
 *     @positions.setter
 *     def positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of positions to self.positions. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_63positions, 0, __pyx_n_s_FXStrategy_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_positions, __pyx_t_6) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1387
 *                             self._c_ignore_type_checking)
 *         self.position_from_py(inp)
 *     @positions.deleter             # <<<<<<<<<<<<<<
 *     def positions(self):
 *         del self.positions
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_positions);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_positions);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1388
 *         self.position_from_py(inp)
 *     @positions.deleter
 *     def positions(self):             # <<<<<<<<<<<<<<
 *         del self.positions
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_65positions, 0, __pyx_n_s_FXStrategy_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_positions, __pyx_t_6) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1392
 * 
 *     @property
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self.merged_positions. See docstring of FXStrategy class for further information.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_67merged_positions, 0, __pyx_n_s_FXStrategy_merged_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1391
 *         del self.positions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def merged_positions(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_positions, __pyx_t_5) < 0) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1398
 *         """
 *         return ProtectedDict(self.self_parse_merged_positions())
 *     @merged_positions.setter             # <<<<<<<<<<<<<<
 *     def merged_positions(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_merged_positions);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_merged_positions);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1399
 *         return ProtectedDict(self.self_parse_merged_positions())
 *     @merged_positions.setter
 *     def merged_positions(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new dict of merged_positions to self.merged_positions. See docstring of FXStrategy class for
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_69merged_positions, 0, __pyx_n_s_FXStrategy_merged_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_positions, __pyx_t_5) < 0) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1419
 *                             self._c_ignore_type_checking)
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter             # <<<<<<<<<<<<<<
 *     def merged_positions(self):
 *         del self.merged_positions
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_merged_positions);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_merged_positions);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1420
 *         self.merged_positions_from_py(inp)
 *     @merged_positions.deleter
 *     def merged_positions(self):             # <<<<<<<<<<<<<<
 *         del self.merged_positions
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_71merged_positions, 0, __pyx_n_s_FXStrategy_merged_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_positions, __pyx_t_5) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1424
 * 
 *     @property
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_73total_balances, 0, __pyx_n_s_FXStrategy_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1423
 *         del self.merged_positions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def total_balances(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_total_balances, __pyx_t_6) < 0) __PYX_ERR(0, 1424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1430
 *         """
 *         return ProtectedList(self.self_parse_total_balances())
 *     @total_balances.setter             # <<<<<<<<<<<<<<
 *     def total_balances(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_total_balances);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_total_balances);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1431
 *         return ProtectedList(self.self_parse_total_balances())
 *     @total_balances.setter
 *     def total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of total_balances to self.total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_75total_balances, 0, __pyx_n_s_FXStrategy_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_total_balances, __pyx_t_6) < 0) __PYX_ERR(0, 1431, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1445
 *                     self._c_ignore_type_checking)
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter             # <<<<<<<<<<<<<<
 *     def total_balances(self):
 *         del self.total_balances
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_total_balances);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_total_balances);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1446
 *         self.total_balances_from_py(inp)
 *     @total_balances.deleter
 *     def total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.total_balances
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_77total_balances, 0, __pyx_n_s_FXStrategy_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_total_balances, __pyx_t_6) < 0) __PYX_ERR(0, 1446, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1450
 * 
 *     @property
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.merged_total_balances. See docstring of FXStrategy class for further information.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_79merged_total_balances, 0, __pyx_n_s_FXStrategy_merged_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1449
 *         del self.total_balances
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def merged_total_balances(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_total_balances, __pyx_t_5) < 0) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1456
 *         """
 *         return ProtectedList(self.self_parse_merged_total_balances())
 *     @merged_total_balances.setter             # <<<<<<<<<<<<<<
 *     def merged_total_balances(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_merged_total_balances);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_merged_total_balances);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1457
 *         return ProtectedList(self.self_parse_merged_total_balances())
 *     @merged_total_balances.setter
 *     def merged_total_balances(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of merged_total_balances to self.merged_total_balances. See docstring of FXStrategy class for
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_81merged_total_balances, 0, __pyx_n_s_FXStrategy_merged_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_total_balances, __pyx_t_5) < 0) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1469
 *                     self._c_ignore_type_checking)
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter             # <<<<<<<<<<<<<<
 *     def merged_total_balances(self):
 *         del self.merged_total_balances
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_merged_total_balances);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_merged_total_balances);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1470
 *         self.merged_total_balances_from_py(inp)
 *     @merged_total_balances.deleter
 *     def merged_total_balances(self):             # <<<<<<<<<<<<<<
 *         del self.merged_total_balances
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_83merged_total_balances, 0, __pyx_n_s_FXStrategy_merged_total_balances, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_merged_total_balances, __pyx_t_5) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1474
 * 
 *     @property
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns list of self.signals. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_85signals, 0, __pyx_n_s_FXStrategy_signals, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1473
 *         del self.merged_total_balances
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def signals(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals, __pyx_t_6) < 0) __PYX_ERR(0, 1474, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1480
 *         """
 *         return ProtectedList(self.self_parse_signals())
 *     @signals.setter             # <<<<<<<<<<<<<<
 *     def signals(self, inp):
 *         """
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_signals);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_signals);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1481
 *         return ProtectedList(self.self_parse_signals())
 *     @signals.setter
 *     def signals(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Set new list of signals to self.signals. See docstring of FXStrategy class for further information.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_87signals, 0, __pyx_n_s_FXStrategy_signals, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals, __pyx_t_6) < 0) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1497
 *             check_types([inp[0][0][0]], [str], ['signal of account in signals setter'], self._c_ignore_type_checking)
 *         self.signals_from_py(inp)
 *     @signals.deleter             # <<<<<<<<<<<<<<
 *     def signals(self):
 *         del self.signals
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_signals);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_signals);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1498
 *         self.signals_from_py(inp)
 *     @signals.deleter
 *     def signals(self):             # <<<<<<<<<<<<<<
 *         del self.signals
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_89signals, 0, __pyx_n_s_FXStrategy_signals, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals, __pyx_t_6) < 0) __PYX_ERR(0, 1498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1502
 * 
 *     @property
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns dict of self._signals_at_step_t.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_91_signals_at_step_t, 0, __pyx_n_s_FXStrategy__signals_at_step_t, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "trapeza/strategy/fx_strategy.pyx":1501
 *         del self.signals
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def _signals_at_step_t(self):
 *         """
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals_at_step_t, __pyx_t_5) < 0) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1512
 *         # readonly access (cython extension type)
 *         return ProtectedDict(self.self_parse_signals_at_step_t())
 *     @_signals_at_step_t.setter             # <<<<<<<<<<<<<<
 *     def _signals_at_step_t(self, inp):
 *         """
 */
  __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_signals_at_step_t);
  if (unlikely(!__pyx_t_6)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_signals_at_step_t);
  }
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_setter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1513
 *         return ProtectedDict(self.self_parse_signals_at_step_t())
 *     @_signals_at_step_t.setter
 *     def _signals_at_step_t(self, inp):             # <<<<<<<<<<<<<<
 *         """
 *         Sets new dict of _signals_at_step_t to self._signals_at_step_t.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_93_signals_at_step_t, 0, __pyx_n_s_FXStrategy__signals_at_step_t, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals_at_step_t, __pyx_t_5) < 0) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1534
 * 
 *         self._signals_at_step_t_from_py(inp)
 *     @_signals_at_step_t.deleter             # <<<<<<<<<<<<<<
 *     def _signals_at_step_t(self):
 *         del self._signals_at_step_t
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_signals_at_step_t);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_signals_at_step_t);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_deleter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1535
 *         self._signals_at_step_t_from_py(inp)
 *     @_signals_at_step_t.deleter
 *     def _signals_at_step_t(self):             # <<<<<<<<<<<<<<
 *         del self._signals_at_step_t
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_95_signals_at_step_t, 0, __pyx_n_s_FXStrategy__signals_at_step_t, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_signals_at_step_t, __pyx_t_5) < 0) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1539
 * 
 *     @property
 *     def _ignore_type_checking(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns current status whether types are checked (=False) at every method call or if checks are ignored (=True).
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_97_ignore_type_checking, 0, __pyx_n_s_FXStrategy__ignore_type_checking, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "trapeza/strategy/fx_strategy.pyx":1538
 *         del self._signals_at_step_t
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def _ignore_type_checking(self):
 *         """
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ignore_type_checking_2, __pyx_t_6) < 0) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1549
 * 
 * 
 *     def __init__(self, str name, accounts, strategy_func, long lookback, tick_func=None, suppress_ticking=False,             # <<<<<<<<<<<<<<
 *                  ignore_type_checking=False, **kwargs):
 *         """
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_99__init__, 0, __pyx_n_s_FXStrategy___init, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  PyList_Append(__pyx_t_4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__103);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1705
 *                          ignore_type_checking, strategy_kwargs, tick_kwargs)
 * 
 *     def _check_parse_accounts(self, accounts):             # <<<<<<<<<<<<<<
 *         """
 *         Checks if accounts (or account) are derived from trapeza.account.base_account.BaseAccount and
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_101_check_parse_accounts, 0, __pyx_n_s_FXStrategy__check_parse_accounts, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_check_parse_accounts, __pyx_t_6) < 0) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1730
 *             raise e
 * 
 *     def _init_all_positions(self, all_keys):             # <<<<<<<<<<<<<<
 *         """
 *         Initializes positions (self.depot_position and self.depot_composite_positions)
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_103_init_all_positions, 0, __pyx_n_s_FXStrategy__init_all_positions, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init_all_positions, __pyx_t_6) < 0) __PYX_ERR(0, 1730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1740
 *         self._c_init_accs_depots(list(all_keys))
 * 
 *     def _reset_storage(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage (before self.run() is called):
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_105_reset_storage, 0, __pyx_n_s_FXStrategy__reset_storage, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_reset_storage, __pyx_t_6) < 0) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1749
 *         self._c_reset_storage()
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Resets internal storage of FXStrategy and storage of accounts. Restores account depot status to the same
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_107reset, 0, __pyx_n_s_FXStrategy_reset, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_reset_2, __pyx_t_6) < 0) __PYX_ERR(0, 1749, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1760
 *         self.c_reset()
 * 
 *     def _tick_method(self, dict data):             # <<<<<<<<<<<<<<
 *         """
 *         Default ticking method if self.suppress_ticking=False and None passed to self.tick_func at
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_109_tick_method, 0, __pyx_n_s_FXStrategy__tick_method, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_tick_method_2, __pyx_t_6) < 0) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1793
 *         _c_tick_method(self, data)
 * 
 *     def evaluate(self, dict data_frame, str reference_currency, append_to_results):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluates accounts regarding position sizes and total balances (expressed in reference currency), as well as
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_111evaluate, 0, __pyx_n_s_FXStrategy_evaluate, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_evaluate, __pyx_t_6) < 0) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1865
 *         return self.c_wrap_evaluate(data_frame, reference_currency.encode(), append_to_results)
 * 
 *     def add_signal(self, acc, str signal):             # <<<<<<<<<<<<<<
 *         """
 *         Adds signal of specific account for current time step t, which is then automatically processed and appended to
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_113add_signal, 0, __pyx_n_s_FXStrategy_add_signal, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_add_signal, __pyx_t_6) < 0) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1909
 *         self.c_add_signal(i, signal.encode())
 * 
 *     def run(self, dict price_data, str reference_currency, volume_data=None):             # <<<<<<<<<<<<<<
 *         """
 *         Runs strategy_func with supplied data. Data is fed in via looping through every time step of data.
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_10FXStrategy_115run, 0, __pyx_n_s_FXStrategy_run, NULL, __pyx_n_s_trapeza_strategy_fx_strategy, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__120);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_run, __pyx_t_6) < 0) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":778
 * 
 * # noinspection PyAbstractClass,PyAttributeOutsideInit,PyUnresolvedReferences,PyTypeChecker
 * class FXStrategy(cFXStrategy, BaseStrategy):             # <<<<<<<<<<<<<<
 *     """
 *     Derived from BaseStrategy class. This implementation is meant to be used with FXAccount (patched by
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FXStrategy, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FXStrategy, __pyx_t_6) < 0) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_cFXStrategy(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7trapeza_8strategy_11fx_strategy_3__pyx_unpickle_cFXStrategy, NULL, __pyx_n_s_trapeza_strategy_fx_strategy); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_cFXStrategy, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "trapeza/strategy/fx_strategy.pyx":1
 * import inspect             # <<<<<<<<<<<<<<
 * import itertools
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_long")
 * cdef vector[X] __pyx_convert_vector_from_py_long(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init trapeza.strategy.fx_strategy", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init trapeza.strategy.fx_strategy");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* set_iter */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set) {
#if CYTHON_COMPILING_IN_CPYTHON
    is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
    *p_source_is_set = is_set;
    if (likely(is_set)) {
        *p_orig_length = PySet_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#else
    (void)is_set;
    *p_source_is_set = 0;
#endif
    *p_orig_length = 0;
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set) {
    if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
        *value = PyIter_Next(iter_obj);
        if (unlikely(!*value)) {
            return __Pyx_IterFinish();
        }
        (void)orig_length;
        (void)ppos;
        return 1;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
        PyErr_SetString(
            PyExc_RuntimeError,
            "set changed size during iteration");
        return -1;
    }
    {
        Py_hash_t hash;
        int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
        assert (ret != -1);
        if (likely(ret)) {
            Py_INCREF(*value);
            return 1;
        }
    }
#endif
    return 0;
}

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* decode_c_bytes */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        stop = length;
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* SliceTupleAndList */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* PyObjectGetAttrStrNoError */
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchInspect */
static PyObject* __Pyx_patch_inspect(PyObject* module) {
#if defined(__Pyx_Generator_USED) && (!defined(CYTHON_PATCH_INSPECT) || CYTHON_PATCH_INSPECT)
    static int inspect_patched = 0;
    if (unlikely((!inspect_patched) && module)) {
        module = __Pyx_Coroutine_patch_module(
            module, ""
"old_types = getattr(_module.isgenerator, '_cython_generator_types', None)\n"
"if old_types is None or not isinstance(old_types, set):\n"
"    old_types = set()\n"
"    def cy_wrap(orig_func, type=type, cython_generator_types=old_types):\n"
"        def cy_isgenerator(obj): return type(obj) in cython_generator_types or orig_func(obj)\n"
"        cy_isgenerator._cython_generator_types = cython_generator_types\n"
"        return cy_isgenerator\n"
"    _module.isgenerator = cy_wrap(_module.isgenerator)\n"
"old_types.add(_cython_generator_type)\n"
        );
        inspect_patched = 1;
    }
#else
    if ((0)) return __Pyx_Coroutine_patch_module(module, NULL);
#endif
    return module;
}

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CyFunctionClassCell */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
    Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions);
    for (i = 0; i < count; i++) {
        __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            PyList_GET_ITEM(cyfunctions, i);
#else
            PySequence_ITEM(cyfunctions, i);
        if (unlikely(!m))
            return -1;
#endif
        Py_INCREF(classobj);
        m->func_classobj = classobj;
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF((PyObject*)m);
#endif
    }
    return 0;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const short neg_one = (short) -1, const_zero = (short) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(short) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(short) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(short),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const short neg_one = (short) -1, const_zero = (short) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
                            return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
                            return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 4 * PyLong_SHIFT) {
                            return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            short val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (short) -1;
        }
    } else {
        short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (short) -1;
        val = __Pyx_PyInt_As_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to short");
    return (short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to short");
    return (short) -1;
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* FunctionExport */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* VoidPtrImport */
#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
