MT5-CRYSTAL
Crystal-lang based client for the MQL5-JSON-API ("khramkov").
Client ported from examples from https://github.com/khramkov/MQL5-JSON-API
Installation
Add this to your application's shard.yml
:
dependencies:
mt5crystal:
github: jekroll/mt5crystal
Usage
require "mt5crystal"
# Subscribe and receive tick data
api = MT5API::Client.new()
socket = api.live_socket()
api.construct_and_send({
"action" => "CONFIG",
"symbol" => "BTCEUR",
"chartTF" => "TICK"
})
# Listen for data and parse JSON
while true
rcv = JSON.parse( socket.receive_string() )
sellValue = rcv[ "data" ][ 1 ].as_f
buyValue = rcv[ "data" ][ 2 ].as_f
puts sellValue, buyValue
end
TODO
- [ ] Add tests
- [ ] Add better documentation
- [ ] Add examples
Contributing
- Fork it ( https://github.com/jekroll/mt5crystal/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- jekroll José Eduardo Kroll - creator, maintainer