SetNet.Marketplace 1.2.0

dotnet add package SetNet.Marketplace --version 1.2.0
                    
NuGet\Install-Package SetNet.Marketplace -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SetNet.Marketplace" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetNet.Marketplace" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SetNet.Marketplace" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetNet.Marketplace --version 1.2.0
                    
#r "nuget: SetNet.Marketplace, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SetNet.Marketplace@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetNet.Marketplace&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SetNet.Marketplace&version=1.2.0
                    
Install as a Cake Tool

<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>

SetNet.Marketplace

A continuous order-book marketplace for SetNet — like a stock exchange for your game economy.

Players post limit buy and sell orders; the server runs a double-sided order book per item with price-time priority. Crossing orders match instantly at the resting order's price and the remainder rests on the book — no timers, no per-item auctions. Items and currency are escrowed on post and moved through SetNet.Inventory / SetNet.Wallet, and a marketable order can only improve on its limit (the buyer is refunded the difference). Added by composition — no base class.

Install

dotnet add package SetNet
dotnet add package SetNet.Inventory
dotnet add package SetNet.Wallet
dotnet add package SetNet.Marketplace

Usage

Call InventoryRuntime.Enable(), WalletRuntime.Enable(), and MarketplaceRuntime.Enable() at startup.

// server
InventoryRuntime.Enable(); WalletRuntime.Enable(); MarketplaceRuntime.Enable();
var inventory = server.UseInventory();
var wallet = server.UseWallet();
server.UseMarketplace(inventory, wallet);

// client
InventoryRuntime.Enable(); WalletRuntime.Enable(); MarketplaceRuntime.Enable();
var market = client.UseMarketplace();
market.Filled += f => Toast($"{f.Side} {f.Quantity}× {f.ItemId} @ {f.Price}");

await market.PostSellAsync("iron_ore", quantity: 100, price: 5);   // ask
await market.PostBuyAsync ("iron_ore", quantity: 40,  price: 6);   // bid — crosses, trades at 5, 5 refunded/unit

MarketBook book = await market.GetBookAsync("iron_ore");           // aggregated levels
foreach (var o in await market.MyOrdersAsync()) Show(o);
await market.CancelAsync(orderId);

API

Server: server.UseMarketplace(InventoryServer, WalletServer)MarketplaceServer. Client: client.UseMarketplace()MarketplaceClient

Member Purpose
Task<string> PostBuyAsync(itemId, quantity, price, currency = "gold") bid (escrows currency)
Task<string> PostSellAsync(itemId, quantity, price, currency = "gold") ask (escrows items)
Task CancelAsync(orderId) cancel + return remaining escrow
Task<MarketBook> GetBookAsync(itemId, currency = "gold") aggregated bids/asks
Task<IReadOnlyList<MarketOrder>> MyOrdersAsync() your open orders
event Action<MarketFill> Filled one of your orders (partially) filled

InventoryRuntime.Enable() + WalletRuntime.Enable() + MarketplaceRuntime.Enable() — one-time bootstrap.

Notes

  • Rides the unified SetNet.Protocol messaging layer on the Channels.Marketplace channel (all modules share one envelope wire type, 65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framed byte[], your payloads use your SetNetSerializer.
  • Price-time priority. Best price first, ties broken by who posted earlier. A trade executes at the resting order's price, so an incoming order never does worse than its limit; a buyer whose limit beats the ask is refunded the difference per unit.
  • Escrow on post. A buy escrows price × quantity currency; a sell escrows quantity items. Matching is decided under a per-book lock; the item/currency moves run afterward through SetNet.Inventory/SetNet.Wallet — nothing is created or lost, and a cancel returns the remaining escrow.
  • Marketplace vs Auction vs Trade: Marketplace is a continuous many-to-many exchange (fungible goods, instant matching); Auction is timed bidding on one specific listing; Trade is a direct two-party swap. Use Marketplace for commodity economies.
  • Node-local books. The book lives on the marketplace node; run one endpoint (or shard by item) so escrow stays consistent. Back SetNet.Inventory/SetNet.Wallet with durable stores for persistence.

Documentation & source

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 91 8/5/2026