• CompuBBS - ECN code (2/2)

    From The Deprogram@21:1/5 to All on Sun Jun 14 08:17:55 2020
    [continued from previous message]

    ? time()+" Jerk boy strange clearing >" +tclearing+"< TOKEN " +tport+"-" +tuser+"-" +ttoken

    return

    endif


    if ! tdisplay $ "YNLRP"

    ? time()+" Jerk boy strange display >" +tdisplay+"< TOKEN " +tport+"-" +tuser+"-" +ttoken

    return

    endif

    if (tdisplay = "R" .or. tdisplay = "P" ) .and. ttif > 0

    ? time()+" Jerk boy R or P or Q display with nonzero tif >" +str(ttif,5,0)+"< TOKEN " +tport+"-"+tuser+"-"+ttoken

    return

    endif

    if !gaccept

    ? time()+" Trade ignored outside SOD-EOD time "+tport+"-" +tuser+"-" +ttoken

    return

    endif

    if tclearing = "A"

    if !gactaccept

    ? time()+" ACT trade ignored outside ACT time " +tport+"-" +tuser+"-" +ttoken

    return

    endif

    endif


    select SOURCES
    replace SEQ with tinseq + 1
    select ISLAND

    do enter2order with tport , tuser , ttoken , tbuy_sell , tshares , tstock , tprice , ttif , xshort , tmmid , tpa , tdisplay , tmin , tclearing , tflags

    case tcommand = "L"

    tolocate = val( substr( ptm , 2 , 8 ) )
    toseq = val( substr( ptm , 10 , 9 ) )
    tshares = val( substr( ptm , 19 , 6 ) )
    treason = substr( ptm , 25 , 1 )

    do case
    case treason = "A"
    xreason = "#USR"
    case treason = "B"
    xreason = "#TME"
    case treason = "C"
    xreason = "#HLT"
    case treason = "D"
    xreason = "#SUP"
    case treason = "E"
    xreason = "#DNT"
    case treason = "F"
    xreason = "#MBL"

    otherwise
    xreason = "#USR"
    endcase

    do new2cancel with tolocate , toseq , tshares , xreason

    case tcommand = "I"

    tport = substr( ptm , 2 , 6 )


    if !seek( tport , "SOURCES" )

    insert into SOURCES values ( tport , 1 )

    endif

    tinseq = val( substr( ptm , 24 , 9 ) )

    if tinseq # SOURCES.SEQ

    if tinseq < SOURCES.SEQ

    *** ? time()+" Duped REJ inseq "+tport+" Expected:"+str( SOURCES.SEQ , 9, 0)+" Got:"+str( tinseq , 9 , 0 )
    return

    endif

    do alert with "Gapped REJ inseq "+tport+" Expected:"+str( SOURCES.SEQ , 9, 0)+" Got:"+str( tinseq , 9 , 0 )

    endif


    tuser = substr( ptm , 8 , 4 )
    ttoken = substr( ptm , 12 , 10 )
    ttype = substr( ptm , 22 , 1 )
    treason = substr( ptm , 23 , 1 )

    do enter2reject with tport , tuser , ttoken , ttype , treason

    select SOURCES
    replace SEQ with tinseq + 1
    select ISLAND

    case tcommand = "Z"

    tolocate = val( substr( ptm , 2 , 8 ) )
    toseq = val( substr( ptm , 10 , 9 ) )
    tshares = val( substr( ptm , 19 , 6 ) )
    treason = substr( ptm , 25 , 1 )

    do case
    case treason = "A"
    xreason = "#USR"
    case treason = "B"
    xreason = "#TME"
    case treason = "C"
    xreason = "#HLT"
    case treason = "D"
    xreason = "#SUP"
    case treason = "E"
    xreason = "#DNT"
    case treason = "F"
    xreason = "#MBL"

    otherwise
    xreason = "#USR"
    endcase


    =i2cancel( tolocate , toseq , tshares , xreason )

    case tcommand = "S"

    tport = substr( ptm , 2 , 6 )

    if !seek( tport , "SOURCES" )

    insert into SOURCES values ( tport , 1 )

    endif

    tinseq = val(substr( ptm , 58 , 9 ) )

    if tinseq # SOURCES.SEQ

    if tinseq < SOURCES.SEQ

    *** ? time()+" Duped REP inseq "+tport+" Expected:"+str( SOURCES.SEQ , 9, 0)+" Got:"+str( tinseq , 9 , 0 )
    return

    endif

    do alert with "Gapped REP inseq "+tport+" Expected:"+str( SOURCES.SEQ , 9, 0)+" Got:"+str( tinseq , 9 , 0 )

    endif

    tuser = substr( ptm , 8 , 4 )
    ttoken = substr( ptm , 12 , 10 )
    tbuy_sell = substr( ptm , 22 , 1 )
    tshares = val( substr( ptm , 23 , 6 ) )
    tstock = substr( ptm , 29 , 6 )
    tprice = val( substr( ptm , 35 , 11 ) )
    treport = substr( ptm , 46 , 1 )
    tshort = substr( ptm , 47 , 1 )
    tpa = substr( ptm , 48 , 1 )
    tmmid = substr( ptm , 49 , 4 )
    tclearing = substr( ptm , 53 , 1 )
    tcontra = substr( ptm , 54 , 4 )


    if ! treport $ "YNS"
    ? time()+" Jerk boy REPORT code TOKEN " +tport

    return

    endif


    if tshares <= 0

    ? time()+" Jerk boy REPORT zero shares TOKEN "+tport+"-"+tuser+"-"+ttoken

    return

    endif


    if tshares >= 1000000

    ? "Jerk boy REPORT million shares TOKEN "+tport+"-"+tuser+"-"+ttoken

    return

    endif


    if tprice <= 0

    ? "Jerk boy REPORT zero price TOKEN "+tport+"-"+tuser+"-"+ttoken

    return

    endif

    if tprice >= 1000000

    ? "Jerk boy REPORT million price TOKEN "+tport+"-"+tuser+"-"+ttoken

    return

    endif


    if ! tclearing $ "ABSIQORN"

    ? "Jerk boy REPORT strange clearing >"+tclearing+"< TOKEN "+tport+"-"+tuser+"-"+ttoken

    return

    endif

    if !gaccept

    ? "Report ignored outside SOD-EOD time "+tport+"-"+tuser+"-"+ttoken

    return

    endif

    if tclearing = "A"

    if !gactaccept

    ? "ACT trade REPORT ignored outside ACT time "+tport+"-"+tuser+"-"+ttoken

    return

    endif

    endif

    do enter2report with tport , tuser , ttoken , tbuy_sell , tshares , tstock , tprice , tshort , tmmid , tpa , treport , tclearing , tcontra

    select SOURCES
    replace SEQ with tinseq + 1
    select ISLAND

    case tcommand = "D"

    tcseq = val( substr( ptm , 2 , 9 ) )
    tcport = substr( ptm , 11 , 6 )
    tcuser = substr( ptm , 17 , 4 )
    tctoken = substr( ptm , 21 , 10 )
    tcbuy_sell = substr( ptm , 31 , 1 )
    tcshares = val( substr( ptm , 32 , 6 ) )
    tcmatch = val( substr( ptm , 38 , 9 ) )
    tcstock = substr( ptm , 47 , 6 )
    tcprice = val( substr( ptm , 53 , 11 ) )
    tcmmid = substr( ptm , 64 , 4 )
    tcmisc = substr( ptm , 68 , 1 )
    tcreason = substr( ptm , 69 , 1 )
    tcclearing = substr( ptm , 70 , 1 )

    do case
    case tcreason = "A"
    xreason = "#ERR"
    case tcreason = "B"
    xreason = "#CON"
    case tcreason = "C"
    xreason = "#SUP"
    case tcreason = "D"
    xreason = "#SYS"
    case tcreason = "E"
    xreason = "#EXT"

    otherwise

    ? time()+" Unvalid break reason = "+tcreason

    return

    endcase

    do case

    case tcbuy_sell = "B"
    xbuy_sell = "B"
    xshort = " "

    case tcbuy_sell = "S"
    xbuy_sell = "S"
    xshort = "L"

    case tcbuy_sell = "T"
    xbuy_sell = "S"
    xshort = "S"

    case tcbuy_sell = "E"
    xbuy_sell = "S"
    xshort = "E"

    otherwise

    ? time()+" Unvalid break buy_sell = "+tcbuy_sell
    return

    endcase

    do enterbreak with tcseq , tcport, tcuser, tctoken, xbuy_sell, tcshares , tcmatch ,tcstock , tcprice , tcmmid , xreason , tcmisc , tcclearing , xshort

    case tcommand = "M"

    tctype = substr( ptm , 2 , 1 )

    do case

    case tctype = "S" && Stock maintence

    tport = substr( ptm , 3 , 6 )
    tuser = substr( ptm , 9 , 4 )
    ttoken = substr( ptm , 13 , 10 )

    tcstock = substr( ptm , 23 , 6 )

    tcshorttype = substr( ptm , 29 , 1 )
    tcblocksub = substr( ptm , 30 , 1 )
    tccenter = substr( ptm , 31 , 1 )
    tcmisc = substr( ptm , 32 , 4 )

    do entermaint with tport, tuser, ttoken, tcstock , tcshorttype , tcblocksub , tccenter , tcmisc

    case tctype = "A" && Account settings

    taccount = substr( ptm , 3 , 6 )
    tpassword = substr( ptm , 9 , 10 )
    ttest = substr( ptm , 19 , 1 )
    ttrusted = substr( ptm , 20 , 1 )
    tthresh = val( substr( ptm , 21 , 6 ) )
    tsscheck = substr( ptm , 27 , 1 )
    tiflag = substr( ptm , 28 , 1 )
    tdefault = substr( ptm , 29 , 4 )

    do enteraccount with taccount, tpassword, ttest , ttrusted , tthresh, tsscheck, tiflag, tdefault

    case tctype = "F" && Account settings

    taccount = substr( ptm , 3 , 6 )
    tmmid = substr( ptm , 9 , 4 )
    tclearing = substr( ptm , 13 , 1 )

    do enterfirm with taccount, tmmid, tclearing

    case tctype = "T" && Stock state

    tport = substr( ptm , 3 , 6 )
    tuser = substr( ptm , 9 , 4 )
    ttoken = substr( ptm , 13 , 10 )

    tcstock = substr( ptm , 23 , 6 )

    tcstate = substr( ptm , 29 , 1 )

    do enterstate with tport, tuser, ttoken, tcstock , tcstate

    otherwise

    ? time()+" Unvalid maint reason = "+tctype


    endcase

    otherwise

    do alert with "Unknown command"+ptm

    endcase

    return

    proc sendeos

    s = "E"
    call int99 with s

    if s # "f" .and. s # "b"

    activate window output

    ? time() +" !!!! ERROR ON EOS WRITE!!!!!!"

    ? ws

    activate window ticker

    suspend

    endif

    return


    proc flush

    s = "F"
    call int99 with s
    if s # "f"
    ? "!!!!ERROR ON FLUSH!!!!"

    do alert with "Error on flush:"+werror(s)
    suspend
    endif

    gstoredflag = .F.

    return

    proc shutdown

    do alert with "Shutdown initiated"

    if !geom && Shutting down too early? Just in case...

    wait window "Can't end day, EOM has not happened yet!" nowait

    do alert with "Ending day attempted before EOM time!"

    return

    endif


    sdk = chr( (rand() * 25) + asc("A") )

    wait window "Initiate Shutdown by pressing ["+sdk+"] within 10 seconds" to sdh timeout 10

    if upper( sdh ) # sdk

    wait window "Shutdown Aborted" nowait

    do alert with "Shutdown aborted"

    return

    endif

    wait window "Confirm Shutdown by pressing the magic key within 10 seconds" to sdh timeout 10

    if upper( sdh ) # "M"

    wait window "Inccorect Shutdown confirmation" nowait

    do alert with "Incorrect shutdown magic key"

    return

    endif

    do alert with "Shutdown confirmed"

    if file( mholdofffile )

    ? "Holdoff file exists! Escalate!"
    suspend

    else

    sdf = fcreate( mholdofffile )
    =fputs( sdf , "Stop in the name of love!")
    =fclose( sdf )

    endif

    if !file( mholdofffile )

    wait window "No HOLDOFF file created, aborting Shutdown" nowait

    do alert with "No HOLDOFF file created, aborting shutdown"

    return

    endif

    wait window "Shutting down..." nowait

    do swrite with "N" , ""
    wait window "Shutting down... 3" timeout 1

    do swrite with "N" , ""
    wait window "Shutting down... 2" timeout 1

    do swrite with "N" , ""
    wait window "Shutting down... 1" timeout 1

    do flush

    wait window "Flushing..." timeout 1

    do sendeos
    do flush

    wait window "Sending End of Session... 3" timeout 1
    do flush

    wait window "Sending End of Session... 2" timeout 1
    do flush

    wait window "Sending End of Session... 1" timeout 1
    do flush

    wait window "Sending End of Session... 0" timeout 1
    do flush

    mdone = .T.

    zap

    return


    proc pingreply
    param preply , ptm

    ptoken = substr( ptm , 2 , 12 )
    pport = substr( ptm , 14 , 4 )

    x = "R"+ptoken+str( tseq ,9,0)+str( tmatch ,9,0)+str(0,9,0)


    s = "S"+chr(len(x))+ preply+pport+ x
    call int99 with s

    return


    proc seteventflags
    param secode

    do case

    case secode = "SOD"

    gaccept = .T.
    gactaccept = .T.

    case secode = "EOA"

    gactaccept = .F.

    case secode = "EOD"

    gaccept = .F.

    case secode = "EOM"

    geom = .T.
    endcase

    return

    proc alert
    parameter s
    xs = dtoc(date())+" "+time() +"-"+ s

    ? xs

    IF FILE( malertfile ) && Does file exist?
    errfile = FOPEN( malertfile ,12) && If so, open read/write
    ELSE
    errfile = FCREATE( malertfile ) && If not create it
    ENDIF

    IF errfile < 0 && Check for error opening file
    WAIT 'Cannot open or create output file' WINDOW NOWAIT
    ELSE && If no error, write to file
    =fseek( errfile, 0 , 2 )
    =FWRITE(errfile, xs + chr(13) + chr(10) )
    ENDIF

    =FCLOSE(errfile) && Close file

    * ? chr(07)+chr(07)+chr(07)+chr(07)
    return -----------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------


    -----------------------------------------------------------------------------------------------------------
    Readme.txt -----------------------------------------------------------------------------------------------------------
    This is Josh Greene's Island ECN program that a former pal of mine once
    used to make 250K. He claimed it is simple and easy to use. So, I
    thought maybe it should be mentioned in the CompuBBS list of tools. The
    code is from the following url:

    http://josh.com/notes/island-ecn-10th-birthday/ http://josh.com/notes/island-ecn-10th-birthday/ISLAND.PRG.TXT

    Please use and edit the code with your own caution. However, learning
    how to deal with monies is important and is considered one of the two
    cardinal virtues of an educated person, along with learning how to communicate. Already, we have the Unix communication tool but we also
    need a nice set of tools for the Fiat monies pragma.

    I tell ya, somethings works and these British itemized pragmas are like
    so wonderful. They are a love affair that just does not quit. So check
    it out and be made successful with them. Again, the thing to encourage
    is synergy. The following networks seem to do something toward team
    work or to say together everyone accomplishes more.:

    #-network - mutuality - meaning - ism - place ----------------------------------------------
    1-Simulcast - comaradery - mutual trust - evangelicalism - church
    2-Internet - reciprocity - mutual respect - capitalism - brothel
    3-Cybermatrix - synergy - mutual success - existentialism - bank
    4-Tektocracy - unity - mutual purpose - republicanism - home
    5-Sneakerweb - infidelity - mutual cheating - secularism - school
    6-Darkring - calumny - mutual defamation - transcendentalism - park

    # - network - tool - idnustry - smurf - mutuality - signal ----------------------------------------------------------
    1 - Simulcast - radio - spiritual - arabian - comaradery - analog
    2 - Internet - computer - technological - indian - reciprocity - digital
    3 - Cybermatrix - television - financial - hispanic - synergy - ?
    4 - Tektocracy - beeper? - political? - russian - unity - ?
    5 - Sneakerweb - tablet - educational - gypsy - infidelity - ?
    6 - Darkring - console - architectural - african - ? - ?
    7 - Datatron - tracker(i.e. fitbit) - medical - european - ? - ?
    8 - Heliopex - watch - recreational - antartican(i.e. British) - ? - ?
    9 - Transpace - PDA(a.k.a smartphone) - sexual - oriental - ? - ?
    10 - Stargate - controller - audiovisual - australian - ? - ?

    Anyway, just ruminating about the Transcendentalism and thier Satanic
    Dharmic mafia is making me sick to my stomach. Time for me to sleep, if
    it is even possible anymore with thie julai state encouragement. God
    bless and God speed for Jesus Christ is God. Always a pleasure. I want
    you to win.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)