USD asset prices on dYdX come from decentralized on-chain oracles, and are used to determine the collateralization of your account. These USD prices are fed to the dYdX smart contracts through price oracles that run on Ethereum.
Each market has a price called the "Index Price" that is calculated based on the oracle prices of the assets in the market. Any features that rely on collateralization, such as stop orders and liquidations, are determined using the oracle/index prices and not the mid market price of the orderbook.
dYdX uses different price oracles for different assets:
For ETH, dYdX uses the MakerDAO ETH-USD V1 Oracle that is used by MakerDAO for their stablecoin SAI, and relies on a distributed network of reporters that report the price of ETH in USD.
For DAI, dYdX uses our own price oracle which calculates the USD price of DAI using a combination of Oasis Trade's on-chain orderbook, Uniswap, and the MakerDAO ETH-USD oracle. The oracle also has several protections against price manipulation on eth2dai and Uniswap.
For USDC, dYdX uses a price of $1 as USDC is exchangeable 1:1 with USD on Coinbase.