A FIX ( Financial Information eXchange ) library written in pure Crystal.
- From Wikipedia
The Financial Information eXchange (FIX) protocol is an electronic communications protocol initiated in 1992 for international real-time exchange of information related to the securities transactions and markets. With trillions of dollars traded annually on the NASDAQ alone, financial service entities are investing heavily in optimizing electronic trading and employing direct market access (DMA) to increase their speed to financial markets. Managing the delivery of trading applications and keeping latency low increasingly requires an understanding of the FIX protocol.
Add this to your application's shard.yml
:
dependencies:
fix:
github: NeuraLegion/fix
require "fix"
Create a Session
object, hook to its callbacks(on_logon
, on_error
, from_admin
, to_admin
, from_app
, and to_app
) and run
.
You can find the below example in the examples/
folder
sess = FIX::Session.new "localhost", 9898
sess.on_logon do
puts "LOGGED ON"
spawn do
cl0rdid = Random.rand(1000..2000)
loop do
msg = FIX::Message.new FIX::MESSAGE_TYPES[:NewOrderSingle]
msg.set_field FIX::TAGS[:Price], "%0.2f" % Random.rand(10.0..13.0).to_s
msg.set_field FIX::TAGS[:OrderQty], Random.rand(100).to_s
msg.set_field FIX::TAGS[:Symbol], "VOD.L"
msg.set_field FIX::TAGS[:SecurityID], "GB00BH4HKS39"
msg.set_field FIX::TAGS[:SecurityIDSource], "4"
msg.set_field FIX::TAGS[:Account], "TEST"
msg.set_field FIX::TAGS[:HandlInst], "1"
msg.set_field FIX::TAGS[:ExDestination], "XLON"
msg.set_field FIX::TAGS[:Side], Random.rand(1..2).to_s
msg.set_field FIX::TAGS[:ClOrdID], cl0rdid.to_s
cl0rdid += 1
msg.set_field FIX::TAGS[:Currency], "GBP"
sess.send_msg msg
sleep 8.seconds
end
end
end
sess.to_admin do |msg|
puts "ADMIN ---->: #{msg.data}"
end
sess.to_app do |msg|
puts "APP ---->: #{msg.data}"
end
sess.from_admin do |msg|
puts "ADMIN <----: #{msg.data}"
end
sess.from_app do |msg|
puts "APP <----: #{msg.data}"
end
sess.on_error do |err|
puts "ERROR: #{err}"
end
sess.run
- Repeating groups decoding
- Encryption
- Server side
- Fork it (https://github.com/NeuraLegion/fix/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
- sekkr1 Dekel - creator, maintainer