coinbase-apifix-protocolquickfixn

QuickFixN: LOGON implementation issue and authentication


Version FIX50SP2.

In quickfix repo, there are messages for both FIX50SP2 and FIXT11: https://github.com/connamara/quickfixn/tree/master/Messages

  1. In docs, I couldn't find even the vaguest notion regarding which one I need to choose to implement FIX client LOGON for version FIX50SP2.
  2. Am I supposed to send Logon messages explicitly or I need to implement authentication in ToAdmin method?

This is the current snippet to intercept ToAdmin so that to add credentials:

    public void ToAdmin(QuickFix.Message message, SessionID sessionId)
    {
        // Customize admin messages before sending

        string msgType = message.Header.GetString(Tags.MsgType);

        if (msgType == MsgType.LOGON)
        {
            // Coinbase-specific fields
            string apiKey = _settings.Get(sessionId).GetString("SenderCompID"); // API Key
            string secret = _settings.Get(sessionId).GetString("Secret"); // API Secret
            string passphrase = _settings.Get(sessionId).GetString("Passphrase"); // API Passphrase

Implementing this API: https://docs.cdp.coinbase.com/exchange/docs/fix-msg-order-entry-50#logon-35a


Solution

  • I'm not sure what docs you read, but you are going about this quite wrong.

    Creating and sending a message should look somewhat similar this, which I'm copy/pasting right from the web site docs.

    FIX44.NewOrderSingle order = new FIX44.NewOrderSingle(
        new ClOrdID("1234"),
        new Symbol("AAPL"),
        new Side(Side.BUY),
        new TransactTime(DateTime.Now),
        new OrdType(OrdType.MARKET));
    
    // add optional fields here if needed
    
    Session.SendToTarget(order, sessionID);
    

    You will be using FIX50SP2 instead of FIX44.

    In FIX5, the consortium split "admin" messages (logon, logout, heartbeat, etc.) into their own dictionary, and that's what FIXT11 is. You probably won't be creating those messages manually.

    ToAdmin is for intercepting outgoing admin messages before they go out to the counterparty, in case you need to tweak them. Most often it's used to inject username/password fields into logon messages. I don't know what you are attempting to do, but it looks like it's based on a misunderstanding.

    Have you looked at the QF/n examples? I highly recommend running the TradeClient and Executor against each other in different terminals, and then checking out the code.