Page 1 of 3

keyboard shortcuts for trading

Posted: Mon Jan 21, 2019 6:50 pm
by mdtrader
is it possible to define custom keyboard shortcuts for trading commands like
buy/sell limit/market
move stop +/- 1tick
move target +/-1tick

The reason is, I use a trading keyboard for trading via SierraChart and it's faster then using the mouse but it works not with Bookmap generated orders, would be great to use it with Bookmap also

thanks

Re: keyboard shortcuts for trading

Posted: Sun Aug 04, 2019 1:30 pm
by Swishy27
I second this recommendation.  This is especially useful in fast markets where point and click execution is a liability.

Re: keyboard shortcuts for trading

Posted: Wed Aug 07, 2019 10:45 pm
by rutariq
Totally agree, keyboard shortcuts are way more in control rather pinpointing mouse generated order.

Most of the trade apps offer kb shortcuts:

LMT B/S
MKT B/S
Increase/Decrease LMT orders & STP orders
Preset Bracket orders
Close/Flaten/Reverse

Re: keyboard shortcuts for trading

Posted: Thu Aug 08, 2019 5:49 am
by Andry API support
Hi all,
you may want to implement these features yourself.
Use Simplified interface, create a KeyEventDispatcher object and assign keys to desired actions.
Here's an example:

Code: Select all

 
package com.bookmap.api.simple.simplified;

import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

import velox.api.layer1.annotations.Layer1ApiVersion;
import velox.api.layer1.annotations.Layer1ApiVersionValue;
import velox.api.layer1.annotations.Layer1SimpleAttachable;
import velox.api.layer1.annotations.Layer1StrategyName;
import velox.api.layer1.annotations.Layer1TradingStrategy;
import velox.api.layer1.common.Log;
import velox.api.layer1.data.ExecutionInfo;
import velox.api.layer1.data.InstrumentInfo;
import velox.api.layer1.data.OrderInfoUpdate;
import velox.api.layer1.simplified.Api;
import velox.api.layer1.simplified.CustomModule;
import velox.api.layer1.simplified.OrdersListener;
import velox.api.layer1.simplified.InitialState;
import velox.api.layer1.data.OrderSendParameters;
import velox.api.layer1.data.SimpleOrderSendParametersBuilder;

@Layer1SimpleAttachable
@Layer1StrategyName("Send Order By Key")
@Layer1ApiVersion(Layer1ApiVersionValue.VERSION1)
@Layer1TradingStrategy
public class SendOrderByKey implements CustomModule, OrdersListener {
    Api api;
    private String alias;
    private KeyEventDispatcher customDispatcher;
    List<OrderInfoUpdate> list = new ArrayList<>();
    
    String orderAliasTarget;
    String orderAliasStop;
    int updateCount;

    @Override
    public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
        this.alias = alias;
        this.api = api;
        listenForKey();
    }

    @Override
    public void stop() {
        KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(customDispatcher);
    }
    
    private void sendMarketOrber (boolean isBuy ) {
        if (isBuy) {
        SimpleOrderSendParametersBuilder shortOrderSendParameters = new  SimpleOrderSendParametersBuilder (alias, false, 1);
        shortOrderSendParameters.setSize(10);
        shortOrderSendParameters.setBuy(isBuy);
        OrderSendParameters shortOrder = shortOrderSendParameters.build();
        api.sendOrder(shortOrder);
        
        } else {
            SimpleOrderSendParametersBuilder OrderSendParameters = new SimpleOrderSendParametersBuilder (alias, false, 1);
            OrderSendParameters.setLimitPrice(6300);
            OrderSendParameters.setSize(10);
            OrderSendParameters.setBuy(isBuy);
            OrderSendParameters.setTakeProfitOffset(5);
            OrderSendParameters.setStopLossOffset(6);
            OrderSendParameters.setStopLossClientId(isBuy?"longStop":"shortStop");
            OrderSendParameters.setTakeProfitClientId(isBuy?"longTarget":"shortTarget");            
            OrderSendParameters orderParam = OrderSendParameters.build();
            orderAliasStop = OrderSendParameters.getStopLossClientId();
            orderAliasTarget= OrderSendParameters.getTakeProfitClientId();
            api.sendOrder(orderParam);
        }
        
    }

    private void listenForKey() {
        customDispatcher = new KeyEventDispatcher() {
            @Override
            public boolean dispatchKeyEvent(KeyEvent e) {
                switch (e.getID()) {
                case KeyEvent.KEY_PRESSED:
                    if (e.getKeyChar() == 'b') {
                        sendMarketOrber(true);
                    }
                    if (e.getKeyChar() == 's') {
                        sendMarketOrber(false);
                    }
                    break;
                case KeyEvent.KEY_RELEASED:
                    break;
                case KeyEvent.KEY_TYPED:
                    break;
                }
                return false;
            }
        };
        
        KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(customDispatcher);
    }
    
    @Override
    public void onOrderUpdated(OrderInfoUpdate orderInfoUpdate) {
        list.add(orderInfoUpdate);
        Log.info("UPDATE " + updateCount++);
    }

    @Override
    public void onOrderExecuted(ExecutionInfo executionInfo) {
        // TODO Auto-generated method stub
    }
}

Re: keyboard shortcuts for trading

Posted: Tue Aug 13, 2019 1:56 pm
by IntheZone
ANDREW --
Thanks for the code -- it looks awesome.

I also need these keyboard shortcuts.

how exaclty do we add this code / make the API?  Is there a video we can see to do it?  Thanks a million!

Re: keyboard shortcuts for trading

Posted: Tue Aug 13, 2019 3:25 pm
by Andry API support
Hi IntheZone,
the code I have posted is a sample 'custom user module' created for Bookmap with a Simplified API. Take a look at this package
https://github.com/BookmapAPI/DemoStrategies
There's a brief overview in the Doc folder. You are welcome to ask your questions if something goes wrong.
There are a bunch of simplified demo strategies in that package, take a look at them. they are created with a very simple yet powerful Simplified interface. To make your module work just extend some simple interfaces, launch your strategy to Bookmap and voila you have your own strategy working. All you need is some software development background.

Re: keyboard shortcuts for trading

Posted: Sat Aug 31, 2019 5:33 am
by mpxtreme
The issue with adding our own user custom features, is that they need to be re-imported on updates or re-installs.

This feature is standard in the majority of trade execution platforms.

At least the basics.

Join Bid or Buy Limit
Buy Ask
Join Offer or Sell Limit
Sell Bid
Buy Market
Sell Market
Cancel All
Cancel All + Liquidate

Thanks
 

Re: keyboard shortcuts for trading

Posted: Mon Sep 02, 2019 2:37 am
by IntheZone
mpxtreme wrote:
Sat Aug 31, 2019 5:33 am
The issue with adding our own user custom features, is that they need to be re-imported on updates or re-installs.

This feature is standard in the majority of trade execution platforms.

At least the basics.

Join Bid
Buy Offer
Join Offer
Hit Bid
Buy Market
Sell Market
Cancel All
Cancel All + Liquidate

Thanks



Yes -- 100% we need to be able to set  Instant FLATTEN of Trade.  Definitely 100% very very important.

I also need >>> 
Move all stops to mouse pointer price or mouse pointer click price
Move all LIMIT ORDERS / Take Profits to Mouse Pointer click price

REVERSE POSITION also?

 

Re: keyboard shortcuts for trading

Posted: Mon Sep 02, 2019 5:59 am
by IntheZone
AndreyR wrote:
Tue Aug 13, 2019 3:25 pm
Hi IntheZone,
the code I have posted is a sample 'custom user module' created for Bookmap with a Simplified API. Take a look at this package
https://github.com/BookmapAPI/DemoStrategies
There's a brief overview in the Doc folder. You are welcome to ask your questions if something goes wrong.
There are a bunch of simplified demo strategies in that package, take a look at them. they are created with a very simple yet powerful Simplified interface. To make your module work just extend some simple interfaces, launch your strategy to Bookmap and voila you have your own strategy working. All you need is some software development background.

Andrew -- Github pdf said we need Eclipse in 32bit?  is that true?  I could only see 64bit Eclipse download there.
Thanks

Re: keyboard shortcuts for trading

Posted: Mon Sep 02, 2019 7:35 am
by Andry API support
Oops no, thx for your comment. Use Eclipse x64 and Java 8 x64. I will fix the guide today.