'pyserum place order unknow instruction error

I'm trying to convert SOL to USDT using pyserum. Here's the code I'm using.

import base58
from pyserum.connection import conn
from pyserum.enums import OrderType, Side
from pyserum.market import Market
from pyserum.connection import get_live_markets, get_token_mints
from solana.publickey import PublicKey
from solana.rpc.types import TxOpts
from solana.keypair import Keypair
from spl.token.client import Token
from spl.token.constants import TOKEN_PROGRAM_ID
from config import PRIVATEKEYPHANTOM

all_mint_address = get_token_mints()
all_market_address = get_live_markets()

if __name__ == '__main__':
    from_coin = 'SOL'
    to_coin = 'USDT'
    symbol = f"{from_coin}/{to_coin}"
    market_address = fetch_market_address(symbol)
    mint_address = fetch_mint_address(symbol)
    
    sender_key_pair = get_keypair(PRIVATEKEYPHANTOM)
    payer = Keypair(sender_key_pair[:32])
    
    cc = conn("https://api.mainnet-beta.solana.com")

    quote_token = Token(
        cc,
        pubkey=PublicKey(mint_address), # mint address of token USDT
        program_id=TOKEN_PROGRAM_ID,
        payer=payer,
    )


    quote_wallet = quote_token.create_account(
    payer.public_key,
    skip_confirmation=True)  # Make sure you send tokens to this address
    print("quote wallet: ", str(quote_wallet))


    market_address = PublicKey(market_address) # Address for SOL/USDT
    print(market_address)
    market = Market.load(cc, market_address)

    tx_sig = market.place_order(
        payer=quote_wallet,
        owner=payer,
        side=Side.BUY,
        order_type=OrderType.LIMIT,
        limit_price=0.01,
        max_quantity=1,
        opts = TxOpts(skip_preflight=True)
    )
    print(tx_sig)
    

Although, I receive the following error after execution. ** Transaction failed: Error processing Instruction 1: Unknown instruction error **

Full error can be found here



Solution 1:[1]

I struggled with the same error and finally I found that's a good idea to replicate the order at some Serum based UI. I used https://dex.raydium.io and when I tried to replicate the error I've got

Price must be an increment of 0.1

For SOL/USDC at least, there is a rule that I need to trade at least amount of 0.1. I don't know why this limitation is set at DEX and why pyserum does not show some more readable error but at least changing from 0.01 to 0.1 helped me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chalda