Fix API authentication New

Hi,

I am trying to connect to the fix API, but with no luck so far.

For me, it is unclear what api key / credentials I need to use. I got an api key / secret from my Coinbase account. I also have an api key / secrets from the cloud environment. Which one should I use? I verified both key pairs, the first one on the C# nuget package and the second one on the Advanced Trading API. Both work there. I tried both in combination with the QuickFixnuget, but cannot get it working.

Here are some code snippets that I use:

        var orderUrl = "fix-ord.exchange.coinbase.com";
        var marketUrl = "fix-md.exchange.coinbase.com";

        var orderDemoUrl = "fix-ord.sandbox.exchange.coinbase.com";
        var marketDemoUrl = "fix-md.sandbox.exchange.coinbase.com";

public void ToAdmin(Message message, SessionID sessionID)
{
Console.WriteLine("ToAdmin: " + sessionID.ToString());

// If your counterparty requires a username and password for logon, add them here
if (message.Header.GetString(Tags.MsgType) == MsgType.LOGON)
{
    // Set the fields as per the requirement
    message.Header.SetField(new BeginString("FIXT.1.1"));
    message.Header.SetField(new SenderCompID(_sessionId.SenderCompID));
    message.Header.SetField(new TargetCompID(_sessionId.TargetCompID));
    message.SetField(new MsgSeqNum(1)); // Tag 34, Must be 1
    message.SetField(new EncryptMethod(0)); // Tag 98, Must be 0 (None)
    message.SetField(new HeartBtInt(10)); // Tag 108, Heartbeat interval defaults to 10s (capped at 300s)
    message.SetField(new Username("USERNAME???")); // Tag 553, Any string is accepted
    message.SetField(new Password("API KEY??")); // Tag 554, Client API passphrase
    message.SetField(new RawDataLength(10)); // Tag 95, Number of bytes in RawData field (adjust according to your data)
    message.SetField(new RawData("YourSignature")); // Tag 96, Client message signature
    message.SetField(new DefaultApplVerID("9")); // Tag 1137, Must be 9 (FIX 5.0 SP2)
    message.SetField(new Password("API KEY??"));
}

}

        string configString = $@"
            [DEFAULT]
            ConnectionType=initiator
            ReconnectInterval=60
            HeartBtInt=30
            SocketConnectHost={marketUrl}
            SocketConnectPort=6121
            StartTime=00:00:00
            EndTime=23:59:59
            UseDataDictionary=Y
            DataDictionary=FIXT11.xml
            AppDataDictionary=FIX50.xml
            ResetOnLogon=Y
            EncryptMethod=0
            FileLogPath=D:\logs\FIX
            FileStorePath=FIX

            [SESSION]
            BeginString=FIXT.1.1
            SenderCompID={apiKey}
            TargetCompID=Coinbase
            MsgSeqNum=1
            EncryptMethod=0
            DefaultApplVerID=FIX.5.0SP2";

How should I authenticate? Or what am I doing wrong?

Do you have access to Exchange / are you institutional client? If answer is no then you can not use FIX API, you have to use “Advanced” Trade APIs…

Thanks for your response,

What exactly do you mean with institutional client? Do you mean that I have to create business account to be able to generate a FIX API key?