Skip to content

cr0sh/grasshopper-public

Repository files navigation

Grasshopper

Grasshopper is a Rust-based Lua runtime for cryptocurrency trading. It offers these features:

  • Periodic, asynchronous HTTP polling (gh.subscribe())
    • Event loop based on subscription: see library/router.lua
    • Note: On-demand HTTP requests are performed synchronously
  • Native Decimals support(gh.decimal()) - don't panic on handling precision and arithmetic errors like on CCXT!
  • Type annotations based on lua-language-server(aka sumneko-lua): see library/types.lua
  • Supports 6+ cryptocurrency exchanges: Binance, Bithumb, Bybit, Gate.io, OKX, UPbit. More to come!
  • Logging experience with tracing bindings on lua (gh.info, gh.debug, gh.warn, ...)
  • Supports execution of multiple strategies at once (which are traced individually with tracing)

Release strategy

I maintain this on my private repository and periodically synchronize to here. Feel free to ping me with the issue tracker if you want to use this library and it seems to be too outdated.

How to use

Write down your own strategy(multiple strategies supported) on scripts/ and it will be the entrypoint of the runtime. You can import modules from library/ with require(), e.g. local binance = require("binance");

The main entrypoint is ./main.lua.

Grasshopper requires LuaJIT runtime with -DLUAJIT_ENABLE_LUA52COMPAT extensions.

Special Thanks

Thanks to khvzak for the amazing mlua crate, the ultimate Lua bindings for Rust.

  • Due to design choices, I migrated mlua based Rust host bindings to LuaJIT host to C FFI guest bindings. But still thank you for open sourcing convenient bindings!

Thanks to actboy168 for the json.lua library(Vendored in library/json_external.lua.).

Thanks to the CCXT team for inspiration of this project.

About

Rust-based Lua runtime for cryptocurrency trading

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages