Mini Margin Tool Script

Hello.
I made a small PowerShell script to check the marginality.
This script reads Marketlogs when you click on the button “Export to File”

As a rule, the program (PowerShell) is preinstalled in Windows

  1. Open Windows Power Shell ISE
  2. Сopy and paste the text below
  3. Run the script
  4. Each time you select a trading position, click “Export to File”

!!! I hope this script does not violate any rules !!!

# If you liked this script, 
# you can make an ISK donation to the Piastra character
# tnx

$CONFIG = @{
    'BrokerFee' = 0.027
    'SaleTax' = 0.08
    'LogFolderPath' = 'Documents\EVE\logs\Marketlogs'
    'FileType' = '*.txt'
    'Margin' = 2
    'Divider' = 1000000

}

$param = @{
    Path = $env:HOMEPATH + "\$($CONFIG.LogFolderPath)"
    Filter = $CONFIG.FileType -as [string]
}
$LastFile = Get-ChildItem @param |
    Sort-Object LastAccessTime -Descending |
    Select-Object -First 1
 
$PastName = $null
$MarginItemList = [System.Collections.Generic.List[PSObject]]::New() 

while ($true){
    
    $param = @{
        Path = $env:HOMEPATH + "\$($CONFIG.LogFolderPath)" -as [string]
        Filter = $CONFIG.FileType -as [string]
    }
    $LastFile = Get-ChildItem @param |
        Sort-Object LastAccessTime -Descending |
        Select-Object -First 1
    
    $param = @{
        Path = $LastFile.FullName
    }
    $RawItemData = Import-Csv @param

    $MinSellOrder = $($SellOrders.price |
        Select-Object -First 1) -as [float]

    $MinSelle = [math]::Round($($MinSellOrder * (1.0 + $CONFIG.SaleTax)), 2)
    
    $fIndex = $LastFile.Name.IndexOf('-')
    $lIndex = $LastFile.Name.LastIndexOf('-')
    $ItemName = $LastFile.Name.Substring($fIndex + 1, $lIndex - ($fIndex + 1))

    if($PastName -ne $ItemName){
        
        $PastName = $ItemName
        
        $param = @{
            Property = 'price', 'volRemaining', 'volEntered', 'minVolume', 'jumps', 'typeID'
        }
        $SellOrders = $RawItemData |
            Where-Object { $_.bid -eq 'False' -and $_.jumps -eq 0} |
            Select-Object @param
        $BuyOrders = $RawItemData |
            Where-Object { $_.bid -eq 'True' -and $_.jumps -eq 0 } |
            Select-Object @param  

        $MinSellOrder = $($SellOrders.price |
            Select-Object -First 1) -as [float]
        $MaxBuyOrder = $($BuyOrders.price |
            Select-Object -First 1) -as [float]
        
        $ItemData = [pscustomobject]@{
            ItemName = $ItemName
            MaxPossibleBuy = [math]::Round($MaxBuyOrder * (1.0 + $CONFIG.BrokerFee), 2)
            MinPossibleSell = [math]::Round($MinSellOrder - ($MinSellOrder * ($CONFIG.SaleTax + $CONFIG.BrokerFee)), 2)
        }
        if($ItemData.MinPossibleSell -gt $MinSellOrder) {
            $param = @{
                MemberType = 'NoteProperty'
                Name = 'Marginality'
                Value = ($ItemData.MinPossibleSell - $ItemData.MaxPossibleBuy) / $ItemData.MaxPossibleBuy * 100 * - 1
            }
            $ItemData | Add-Member @param
        }
        else {
            $param = @{
                MemberType = 'NoteProperty'
                Name = 'Marginality'
                Value = ($ItemData.MinPossibleSell - $ItemData.MaxPossibleBuy) / $ItemData.MaxPossibleBuy * 100
            }
            $ItemData | Add-Member @param

            $param = @{
                MemberType = 'NoteProperty'
                Name = 'Profit'
                Value = $ItemData.MinPossibleSell - $ItemData.MaxPossibleBuy
            }
            $ItemData | Add-Member @param
        }
        Clear-Host

        if($ItemData.Marginality -gt $CONFIG.Margin){  
             $MarginItemList.Add($ItemData)
        }

        Write-Host "List of margin items: $($MarginItemList.Count)".ToUpper()
        

        $param = @{
            Propert = @(
                @{n='Item'; e={ $_.ItemName } },
                @{n='Spend'; e={ '{0:N6}' -f $($_.MaxPossibleBuy / $CONFIG.Divider) } }
                @{n='Get'; e={ '{0:N6}' -f $($_.MinPossibleSell / $CONFIG.Divider) } }
                @{n='Profit'; e={ '{0:N6}' -f $($_.Profit / $CONFIG.Divider) } }
                @{n='Margin'; e={ '{0:N2} %' -f $_.Marginality } }
            )
        }
        $MarginItemList |
            Sort-Object -Unique -Property Marginality -Descending |
            Select-Object @param |
            ft -Property * -AutoSize

        Write-Host "Checking the item".ToUpper()

        $param = @{
            Propert = @(
                @{n='Item'; e={ $_.ItemName } },
                @{n='Spend'; e={ '{0:N6}' -f $($_.MaxPossibleBuy / $CONFIG.Divider) } }
                @{n='Get'; e={ '{0:N6}' -f $($_.MinPossibleSell / $CONFIG.Divider) } }
                @{n='Profit'; e={ '{0:N6}' -f $($_.Profit / $CONFIG.Divider) } }
                @{n='Margin'; e={ '{0:N2} %' -f $_.Marginality } }
            )
        }
        $ItemDataDisplay = $ItemData | Select-Object @param
        $ItemDataDisplay | ft

     }
    
    Start-Sleep -Seconds 1
}

if you have doubts of something being against the rules, your best option, is to submit a ticket… its better to ask, than to assume you aren’t violating the rules, than to do this and be violating them.

I’m not sure what you script does.
All automation is against the EULA, that means simulating keys/mouse in eve is not okay.
However, modifying the windows clipboard and reading the eve export files, are not considered exploits.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.