Page 2 of 155 FirstFirst 12345612 ... LastLast
Results 16 to 30 of 2321

Thread: TradeDangerous: power-user trade optimizer

  1. #16
    I've also imported the star position data to form links between systems in version 2.03 which is now checked in.
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  2. #17
    Originally Posted by kfsone View Post (Source)
    I've also imported the star position data to form links between systems in version 2.03 which is now checked in.
    Checked it out.
    Looks very nice. BPC introduced round trips - brilliant. Is that something you are considering?

  3. #18
    Originally Posted by wolverine2710 View Post (Source)
    Checked it out.
    Looks very nice. BPC introduced round trips - brilliant. Is that something you are considering?
    You mean A->B->A? Just tell give it the same --from and --to station.

    TD is a layered system. The trade calculator has a "getBestTrade" function which will find the absolute best cargo load for a trip between two stations.

    Atop that, it has a "getBestHop" calculator which will consider all the possible runs you could make between two sets of stations (A->B, A->C, A->D, B->A, B->C, B->D, D->A, D->B, D->C, ...) and figure out which hop has the best trade.

    And atop that, it has a "getBestRun" calculator which will do a "getBestHop" to produce a series of best runs between stations, take the money you'd make on those hops and do another getBestRun using the results for as many hops as you've provided.

    It has options to constrain stations at the start, end or middle. "--from" to say where it starts from, "--to" to say where it must end, "--via" to say what station you want to pass through en-route (or if you don't specify --from or --to, a station that just has to appear on the route somewhere).

    You can specify number of inter-star jumps per hop, limit the number of light years each jump can be, total number of jumps, number of hops, etc.

    I wrote it because round-trips tend not to be an efficient use of time.

    Lets say the absolute single-jump best run in the galaxy is A->B selling Fish. You can make 500 cr in your sidewinder.

    But B->A the best you can do is scrap for 3 cr a unit a grand total of 12 cr.

    For a round trip, you're going to make 512 cr, or 256 cr a hop.

    Meanwhile, lower down the list of great one-ways is a A->F which makes only 350cr, but F->A has a similar trade which makes 320cr. For a single round trip you make 350 + 320 or 670cr total, 335 cr a hop. That's way more efficient.

    But also rare. In the ED map it tends to require a 3-hop route, and it turns out that A->F makes 350, F->E makes 420, E->A makes 390. That's 1160 for 2 hops, with 386cr a hop. Way better use of your time.

    If there are profitable loops like this, TD will generate them.

    But remember: It's taking into account the profit you're making as you on these runs, so what tends to happen is that the options are changing as you fly.

    [continued]
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  4. #19
    Here's an example scenario:

    You just bought your Hauler, you have 5kcr left, you want to set 2k aside for insurance and you're going to be extra cautious and keep the capacity to 12 units to maintain a healthy jump range. You also want to play it safe in predicting how much you make so you assume that the prices are off by +/-2% (margin 0.02). You're willing to make a few inter-star jumps between stations on each hop. You want to make a ton of money, so you're going to see what 15 hops look like:

    ./trade.py --from Chango --ly-per 6 --jumps-per 3 --capacity 10 --credits 5000 --insurance 2000 --margin 0.02 --hops 15 --detail

    Code:
    I BOOTIS Chango -> I BOOTIS Chango:
     >-> I BOOTIS Chango      Buy 7*Fish (389cr), 3*Scrap (25cr),
       |   i Bootis -> Aulin
     -+- AULIN Enterprise     Buy 7*Agri-Medicines (653cr), 2*Synthetic Meat (87cr),
       |   Aulin -> i Bootis
     -+- I BOOTIS Chango      Buy 10*Fish (389cr),
       |   i Bootis -> Eranin -> LP 98-132
     -+- LP 98-132 Freeport   Buy 10*Coltan (953cr),
       |   LP 98-132 -> Asellus Primus -> Dahan
     -+- DAHAN Gateway        Buy 10*Explosives (162cr),
       |   Dahan -> Morgor
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
       |   Morgor -> Dahan -> Asellus Primus
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Advanced Catalysts (2160cr),
       |   Asellus Primus -> Dahan
     -+- DAHAN Gateway        Buy 8*Tantalum (3714cr), 2*Cobalt (535cr),
       |   Dahan -> Asellus Primus
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Advanced Catalysts (2160cr),
       |   Asellus Primus -> Dahan
     -+- DAHAN Gateway        Buy 10*Tantalum (3714cr),
       |   Dahan -> Asellus Primus
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Personal Weapons (3940cr),
       |   Asellus Primus -> Dahan -> Morgor
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
       |   Morgor -> Dahan -> Asellus Primus
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Personal Weapons (3940cr),
       |   Asellus Primus -> Dahan -> Morgor
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
       |   Morgor -> Dahan -> Asellus Primus
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Auto-Fabricators (3162cr),
       |   Asellus Primus -> Eranin -> i Bootis
     <-< I BOOTIS Chango gaining 77374cr => 80374cr total
    Here it is without the --detail

    Code:
    I BOOTIS Chango -> I BOOTIS Chango:
     >-> I BOOTIS Chango      Buy 7*Fish (389cr), 3*Scrap (25cr),
     -+- AULIN Enterprise     Buy 7*Agri-Medicines (653cr), 2*Synthetic Meat (87cr),
     -+- I BOOTIS Chango      Buy 10*Fish (389cr),
     -+- LP 98-132 Freeport   Buy 10*Coltan (953cr),
     -+- DAHAN Gateway        Buy 10*Explosives (162cr),
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 8*Tantalum (3714cr), 2*Cobalt (535cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 10*Tantalum (3714cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Personal Weapons (3940cr),
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Personal Weapons (3940cr),
     -+- MORGOR Romaneks      Buy 10*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 10*Auto-Fabricators (3162cr),
     <-< I BOOTIS Chango gaining 77374cr => 80374cr total
    There are several round-trip journeys in there. But at the end, it breaks the run. That's because the asellus->morgor->asellus is efficient, but asellus->chango is the more profitable one-way destination out of asellus.

    Along the way, it also deviates from the route. There are small windows where - with the money you've earned - there are other routes that are more profitable.

    If you figure "hey, that's going to make enough money for my next ship", you can tell it you want to finish at Aulin:

    Code:
    I BOOTIS Chango -> AULIN Enterprise:
     >-> I BOOTIS Chango      Buy 7*Fish (389cr), 5*Scrap (25cr),
     -+- AULIN Enterprise     Buy 7*Agri-Medicines (653cr), 4*Biowaste (18cr), 1*Pesticides (97cr),
     -+- I BOOTIS Chango      Buy 12*Fish (389cr),
     -+- LP 98-132 Freeport   Buy 11*Coltan (953cr), 1*Rutile (160cr),
     -+- DAHAN Gateway        Buy 12*Explosives (162cr),
     -+- MORGOR Romaneks      Buy 12*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 9*Tantalum (3714cr), 3*Cobalt (535cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 12*Tantalum (3714cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Personal Weapons (3940cr),
     -+- MORGOR Romaneks      Buy 12*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Auto-Fabricators (3162cr),
     -+- I BOOTIS Chango      Buy 12*Crop Harvesters (1958cr),
     -+- ERANIN Azeban        Buy 12*Tea (1278cr),
     <-< AULIN Enterprise gaining 84708cr => 87708cr total
    The route twists right at the end to try and minimize the loss of neither Asellus or Morgor having a good trade route with Azeban. Maybe we should add Aulin as a 16th hop instead?

    Code:
    I BOOTIS Chango -> AULIN Enterprise:
     >-> I BOOTIS Chango      Buy 7*Fish (389cr), 5*Scrap (25cr),
     -+- AULIN Enterprise     Buy 7*Agri-Medicines (653cr), 4*Biowaste (18cr), 1*Pesticides (97cr),
     -+- I BOOTIS Chango      Buy 12*Fish (389cr),
     -+- LP 98-132 Freeport   Buy 11*Coltan (953cr), 1*Rutile (160cr),
     -+- DAHAN Gateway        Buy 12*Explosives (162cr),
     -+- MORGOR Romaneks      Buy 12*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 9*Tantalum (3714cr), 3*Cobalt (535cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Advanced Catalysts (2160cr),
     -+- DAHAN Gateway        Buy 12*Tantalum (3714cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Personal Weapons (3940cr),
     -+- MORGOR Romaneks      Buy 12*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Personal Weapons (3940cr),
     -+- MORGOR Romaneks      Buy 12*Gallite (1376cr),
     -+- ASELLUS PRIMUS Beagle2 Buy 12*Auto-Fabricators (3162cr),
     -+- I BOOTIS Chango      Buy 12*Fish (389cr),
     <-< AULIN Enterprise gaining 94368cr => 97368cr total
    Boosh - that made a 10k credit difference. You might want to take that.

    Ok. How about, I just want to see the 3 best 4-hop runs I could possibly make. Anywhere. Period. To get a sense of a good area of space to hang out in. (Not specifying --from or --to)

    ./trade.py --ly-per 5 --jumps-per 3 --capacity 14 --credits 5000 --insurance 2000 --margin 0.02 --hops 4 --routes 3
    Code:
    CHI HERCULIS Gorbatko -> OVID Bradfield:
     >-> CHI HERCULIS Gorbatko Buy 7*Fish (389cr), 4*Grain (67cr),
     -+- MAGEC Xiaoguan       Buy 5*Animal Meat (942cr), 6*Fruit and Vegetables (142cr),
     -+- CHI HERCULIS Gorbatko Buy 14*Fish (389cr),
     -+- MAGEC Xiaoguan       Buy 14*Animal Meat (942cr),
     <-< OVID Bradfield gaining 16588cr => 19588cr total 
    
    MAGEC Xiaoguan -> MAGEC Xiaoguan:
     >-> MAGEC Xiaoguan       Buy 14*Fruit and Vegetables (142cr),
     -+- CHI HERCULIS Gorbatko Buy 13*Fish (389cr), 1*Grain (67cr),
     -+- MAGEC Xiaoguan       Buy 10*Animal Meat (942cr), 4*Fruit and Vegetables (142cr),
     -+- CHI HERCULIS Gorbatko Buy 14*Fish (389cr),
     <-< MAGEC Xiaoguan gaining 16186cr => 19186cr total
    
    LHS 417 Gernhardt -> LHS 417 Gernhardt:
     >-> LHS 417 Gernhardt    Buy 14*Rutile (140cr),
     -+- LHS 3262 Louis       Buy 3*Reactive Armor (1485cr), 10*H.E. Suits (101cr),
     -+- LHS 417 Gernhardt    Buy 14*Cobalt (535cr),
     -+- LHS 3262 Louis       Buy 9*Non-Lethal Wpns (1283cr), 4*H.E. Suits (101cr),
     <-< LHS 417 Gernhardt gaining 15745cr => 18745cr total 
    What I'm mostly demonstrating here is the engine. It's pretty flexible. I'm working a layer that will track where you are currently *at*, how many credits you currently *have* so you don't have to keep updating that stuff, and you can use it a little more like a trade-gps with it making route/item updates as you go and update prices etc, but it can also act as a checklist.
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  5. #20
    And just for kicks, that first scenario, what if I blew caution to the wind?

    Code:
    $ ./trade.py --from Chango --ly-per 4 --jumps-per 4 --capacity 16 --credits 5000 --margin 0.01 --hops 15
    I BOOTIS Chango -> AULIN Enterprise:
     >-> I BOOTIS Chango      Buy 12*Fish (389cr), 4*Scrap (25cr),
     -+- AULIN Enterprise     Buy 12*Agri-Medicines (653cr), 2*Synthetic Meat (87cr), 1*Biowaste (18cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 16*Agri-Medicines (653cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 16*Agri-Medicines (653cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 9*Terrain Enrich Sys (3961cr), 5*Agri-Medicines (653cr), 1*Biowaste (18cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 12*Terrain Enrich Sys (3961cr), 4*Agri-Medicines (653cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 16*Terrain Enrich Sys (3961cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     -+- AULIN Enterprise     Buy 16*Terrain Enrich Sys (3961cr),
     -+- I BOOTIS Chango      Buy 16*Fish (389cr),
     <-< AULIN Enterprise gaining 91415cr => 96415cr total
    An extra 14,000 credits or 18% increase... Is it worth the risk that you'll lose everything if you don't see that Lak 9 coming as you enter the slot at Aulin?
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  6. #21
    Thanks for the detailed explanation. I´ve to reread a few times so it really sinks in though ;-) Powerfull stuff.

    It looks even more impressive then BPC wrt routes and its a command prompt tool. All nice. BPC has as advantage and reason I use it that the market data is up to date all the time.

    Things have changed since then. Andreas marketdump tool got a real boost with EMDN - basically EVE´s EMDR. Even BPC does not upload data anymore and MD uploads market info to EMDN. BPC has become a consumer of EMDN. I´m hoping that a future version of TD has optional support for EMDN. Either TD gets data from EMDN and dumps it in the (local) access database or when running TD pulls relevant info fom the EMDN (hence real time and up to data info). MD uses zeroMQ to upload data. You can see the real time data by starting firehose.exe. Should you be willing to consider this optional feature I´m sure Andreas can help you further. It would imho give TD the boost and broader appeal it really deserves.

    PS. Newsletter 36 basically said the traing wheels be removed from the market and its gonna really dynamic.....

  7. #22

    Thumbs up

    Brilliant. Finally a decent trade calculator

    Indeed very good work.

    Now take it to a new level: don't only calculate:
    1. buy X, Y, Z at A
    2. fly through B to C
    3. sell everything
    4. goto 1

    but do this:
    1. buy X, Y, Z at A
    2. fly to B
    3. sell X (leaving Y and Z in the hold), buy W
    4. fly to C
    5. sell Y, W (leaving Z in the hold), buy V
    6. fly to D
    7. sell Z (leaving V in the hold), buy U
    8. [...]

    So taking some items from a earlier station to a station coming later in the pipeline at a higher price and don't selling everything every time.

  8. #23
    Originally Posted by wolverine2710 View Post (Source)
    Thanks for the detailed explanation. I´ve to reread a few times so it really sinks in though ;-) Powerfull stuff.

    It looks even more impressive then BPC wrt routes and its a command prompt tool. All nice. BPC has as advantage and reason I use it that the market data is up to date all the time.

    Things have changed since then. Andreas marketdump tool got a real boost with EMDN - basically EVE´s EMDR. Even BPC does not upload data anymore and MD uploads market info to EMDN. BPC has become a consumer of EMDN. I´m hoping that a future version of TD has optional support for EMDN. Either TD gets data from EMDN and dumps it in the (local) access database or when running TD pulls relevant info fom the EMDN (hence real time and up to data info). MD uses zeroMQ to upload data. You can see the real time data by starting firehose.exe. Should you be willing to consider this optional feature I´m sure Andreas can help you further. It would imho give TD the boost and broader appeal it really deserves.

    PS. Newsletter 36 basically said the traing wheels be removed from the market and its gonna really dynamic.....
    I'm fairly familiar with 0MQ (this is me).

    The way TD is written, it would be fairly easy for someone to make it use a scraped database - either by pulling on the fly or by making a scraper that writes to a local DB.

    But I'm stopping short of doing that myself. I think I've made it fairly easy for someone else to do (and indeed, someone has already forked TD on bitbucket and perhaps that is what they intend to do).

    I'm reluctant to do it myself, based on my experience writing stuff in the X universe (e.g. x2 cargo ferries), because it would eliminate ALL interaction with the market for me. It only takes me a few seconds to update my local DB by hand using MS Access, but those few seconds actually help me get a sense of where the market is fluctuating along the routes.
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  9. #24
    Originally Posted by Dirk Brabeen View Post (Source)
    Brilliant. Finally a decent trade calculator

    Indeed very good work.

    Now take it to a new level: don't only calculate:
    1. buy X, Y, Z at A
    2. fly through B to C
    3. sell everything
    4. goto 1

    but do this:
    1. buy X, Y, Z at A
    2. fly to B
    3. sell X (leaving Y and Z in the hold), buy W
    4. fly to C
    5. sell Y, W (leaving Z in the hold), buy V
    6. fly to D
    7. sell Z (leaving V in the hold), buy U
    8. [...]

    So taking some items from a earlier station to a station coming later in the pipeline at a higher price and don't selling everything every time.
    That gets very expensive to do very quickly, because you accumulate potential routes to compare with every hop - best case is logarithmic. (50 stations = 49 x (49^routes)).

    But I also found that it rarely found combinations that paid off, and with the introduction of fuel costs it's going to be a very, very small margin. It might work for 4-16 capacity ships with a 2 hop limit (everything has to be gone within two hops).

    Or I might be able to use shenanigans ... to do something like, say: if you can only afford 1-2 of something with a high profit threshold and it requires 2 jumps to sell, try and find secondary trades on the hops inbetween.

    So: 4 capacity, 4000cr : 2 x Tea (1500cr) -> A -> [via B] -> C.
    Since we cashed out, and there are 2 hops to get to C, apply a second trade calc to solve A->B->C with 2 capacity and 1000cr finds 1 food cart, 1 alga from A->B pays for the fuel for the trip, 1 bio lichen b->c adds 120 profit which is small but is a significant percentage.

    Would that be sufficient?
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  10. #25
    Just checked in 2.06:
    - Adds a "--checklist" command to walk you through the steps in the route,
    - Adds a "--x52-pro" command to walk you thru the checklist on your X52 Pro MFD


    (click for larger view)

    I'm waiting on feedback from Saitek so I can let you use the X52 MFD buttons rather than having to alt-tab out and hit enter.
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  11. #26
    Originally Posted by kfsone View Post (Source)
    Just checked in 2.06:
    - Adds a "--x52-pro" command to walk you thru the checklist on your X52 Pro MFD
    I like the idea of displaying the route on the MFD. Is also displays the destination next hop?
    What algorithm you applied to calculate the best routes of trade? I am interested in your solution. Since yesterday, trying to understand it.
    I wrote my own program, in which I used two algorithms: Minimax to determine the best next hop, and the knapsack problem to determine the best goods from the station with adequate financial resources. But it involved a small number of stations in Beta Premium (7 stations). Now we have 41 stations, thus finding the optimal solution to this problem seems to be quite difficult.

  12. #27
    This looks fantastic - thank you for sharing it!

    It looks like it's already really useful and will develop into an incredibly powerful tool if you keep developing it

  13. #28
    Originally Posted by demiurge View Post (Source)
    I like the idea of displaying the route on the MFD. Is also displays the destination next hop?
    The display layer will show you the entire route and then, if you specified that you want checklist mode, walk you through it step by step:

    1. Buy 100x frogs
    2. Refuel
    3. Jump to LHS 2887
    4. Jump to Dahan
    5. Dock at Dahan Gateway
    6. Sell 100x frogs
    7. Buy 100x chocolate
    8. Refuel
    9. Jump to ...

    the degree of detail depends on whether or not you specify '--detail'.

    At each step, it displays a summary on the MFD. It's still brand new so I'm open to suggestions. Ideally, I want you to be able to interact with the app via the MFD but Saitek's documentation is abysmal and their API is kinda crap.

    Originally Posted by demiurge View Post (Source)
    What algorithm you applied to calculate the best routes of trade? I am interested in your solution. Since yesterday, trying to understand it.
    A* for the routing selection and my own variant of knapsack for the cargo selection.

    Originally Posted by demiurge View Post (Source)
    I wrote my own program, in which I used two algorithms: Minimax to determine the best next hop, and the knapsack problem to determine the best goods from the station with adequate financial resources. But it involved a small number of stations in Beta Premium (7 stations). Now we have 41 stations, thus finding the optimal solution to this problem seems to be quite difficult.
    It's actually a fairly interesting problem, from an algorithmic point of view, if you want to solve it for yourself and get a good handle on it, grab a bunch of Monopoly money and some index cards and make yourself a small inventory to experiment with - I did this to show my wife how I was doing it (she doesn't understand programming at all).

    The idea is to find simple best fits and then attempt to collapse them (sure I can make $20 from 3 of A, but it turns out with the same money I can afford 4 of B which is less profitable per, but since I can afford 4 I actually make $21). Using python's generators allowed me to do this more lazily and, because of the way I've marshaled the data and modern CPU architecture works, it's actually more efficient than taking the algorithmic approach because it gets less branch fails.
    Author of Trade Dangerous.
    TD now has a Facebook Group!

  14. #29
    Originally Posted by Toumal View Post (Source)
    These guys:












    So envy. Much awesome.

    Wow.

  15. #30
    New version, I'm working on several new features, but this version has a lot of improvements to presentation and "--detail" (or -v for short) can be specified twice to get even more data (e.g. profit/ton on each hop), the X52 Pro MFD is working nicely, and you can now specify --ship rather than having to fill out the ly-per etc fields.

    Version 3.0 will work slightly differently: There'll be sub-commands so you can ask it things like "where do I buy the Anaconda" or "where can I get a C4 Cannon around this neck of the woods?" or "where can I find cheap Tobacco around here" or "what jumps do I have to make to get from chango to Morgor with this ship?".
    Author of Trade Dangerous.
    TD now has a Facebook Group!

Page 2 of 155 FirstFirst 12345612 ... LastLast