Thread: Submission of a order to buy

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2017
    Posts
    2

    Submission of a order to buy

    Hi guys.

    I am writing a code for submitting of order to buy, however it doesn't work. What I should do is to submit one limit order at a time.
    Could you please check it?



    /* Submission of order to buy */


    insert
    Code:
     if (r_i>0) {
    tot_cash[i]=cash[i]-limit_cash[i];
    tot_stocks[i]=stocks[i]-limit_stock[i];
    size=(int)(ran2(&idum)*(tot_cash[i]/b[i])));
    if(size<0){
    printf(“ERROR”, i, tot_stocks[i], stocks[i], limit_stock[i], size, b[i]);
    size=0;
    }
    if(size>stock_max) {
    size=stock_max;
    }
    for(n_trades=0; n_trades<size; n_trades++){
    if(N_a==0){
    temp=1;
    tr=0;
    sign_limit=1;
    vol_bid_limit ++;
    limit_cash[i]+=b[i];
    status[i]++;
    k=-1;
    while (k<N_b){
    k++
    if(b[i]<bl[k]) break;
    }
    k_insert=k;
    for(k = N_b - 1; k > k_insert - 1 ; k--) {
    bl[k+1]=bl[k];
    b_trader[k+1] = b_trader[k] ; bo_t_entry[k+1] = bo_t_entry[k]; 
    }
    bl[k_insert]= b[i]; b_trader[k_insert] = i; bo_t_entry[k_insert] = t; b_t_entry[i] = t;
    N_b ++; 
    }
    else if(N_a>0&&b[i]< al[N_a-1]){ 
    temp=1;
    tr =0;
    sign_limit=1; vol_bid_limit ++; limit_cash[i]+=b[i]; status[i] ++;
    k=-1;
    while( k < N_b){ 
    k++; 
    if(b[i] < bl[k]) break; } 
    k_insert=k;
    for(k = N_b - 1; k > k_insert - 1 ; k--){ 
    bl[k+1]=bl[k];
    b_trader[k+1] = b_trader[k] ; bo_t_entry[k+1] = bo_t_entry[k]; 
    }
    bl[k_insert]= b[i];
    b_trader[k_insert] = i; bo_t_entry[k_insert] = t; b_t_entry[i] = t;
    N_b ++; 
    } 
    else if (N_a >=1
    sign_market=1;
    vol_bid_market
    trading_volume
    p[t]=al[N_a-1];
    execution_time = t- ao_t_entry[N_a-1]; execution_time=1; 
    if(execution_time < TIME_MAX){ 
    distribution_time_a[execution_time]++; count_time_a++; 
    }
    b_t_trade[i] = t;
    b_t_entry[i] = t; status[a_trader[N_a-1]] --; a_t_trade[a_trader[N_a-1]] = t; stocks[i]++; stocks[a_trader[N_a-1]]--; limit_stock[a_trader[N_a-1]]--; 
    cash[a_trader[N_a-1]]+= al[N_a-1]; cash[i] -=al[N_a-1];
    } 
    } 
    }
    Many thanks.
    Last edited by Salem; 03-15-2017 at 08:14 AM. Reason: Fixed tags train wreck

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 04-01-2011, 04:13 PM
  2. Replies: 4
    Last Post: 03-06-2008, 03:38 PM
  3. 46 hours to assignment submission
    By technoXavage in forum Game Programming
    Replies: 9
    Last Post: 12-23-2003, 03:15 PM
  4. what is the significance of low order and high order bits
    By Shadow12345 in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 11:46 AM

Tags for this Thread