Git Product home page Git Product logo

qluacpp's Introduction

QluaCpp

C++ interface for Quik trading terminal via Lua bindings

Интерфейс для написания на C++ плагинов к торговому терминалу Quik через байндинги Lua

// ... 
#include <qluacpp/qlua>

static struct luaL_reg ls_lib[] = {
  { NULL, NULL }
};

void my_main(lua::state& l) {
  qlua::api q(l);
  std::string name;
  q.getSecurityInfo("TQBR", "SBER",
                    [&name] (const auto& sec_info) {     // C++14 style lambda
                      name = sec_info().name();
                      return 1;  // How many stack items should be cleaned up (poped)
                    });
  std::string text = "qluacpp: Hello, world! Ticker's SBER name is " + name;                  
  q.message(msg.c_str());  
}

LUACPP_STATIC_FUNCTION2(main, my_main)
                        
extern "C" {
  LUALIB_API int luaopen_lualib_hello(lua_State *L) {
    lua::state l(L);

    ::lua::function::main().register_in_lua(l, my_main);

    luaL_openlib(L, "lualib_hello", ls_lib, 0);
    return 0;
  }
}

Преимущества

  • Позволяет писать плагины к терминалу Quik на типизированном языке с развитой экосистемой и избежать программирования на сложном для отладке языке Lua
  • Предельная быстрота: в отличие от других интерфейсов к Quik данные не пересылаются и в большинстве случаев даже не копируются, чтение осуществляется непосредственно через ссылки на память терминала. В ряде случаев даже быстрее, чем доступ через встроенный интерпретатор Lua (благодаря C-интерфейсу к API Lua, предоставляющему больше возможностей, чем языковые средства).

Requirements / Требования

  • Lua 5.1 or Lua 5.3 library (depending on target Quik)
  • C++17-compliant compiler (C++17 compliant, tested with VS 2017 15.0)

Usage example / Пример использования

See tutorials for code examples, as well as step by step instruction for creating qluacpp projects.

Примеры содержат пошаговые инструкции и исходные коды небольших плагинов

License / Лицензия

GPL v3.0.

Distribute your source code if you distribute the binaries.

Если распространяете бинарники, прилагайте и исходный код.

qluacpp's People

Contributors

elelel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.