There were several books with the title Xiangniujing 相牛經 "Divination by cattle" or "Inspection of cattle".
A text with this name is first mentioned in a commentary on Xiahou Xuan's 夏侯玄 (208-254) biography in the history Sanguozhi 三國志. It is also quoted in the commentary on the Shishuo xinyu 世說新語. It is said that the book Niujing 牛經 "The book of cattle" was written by Ning Qi 寧戚 (also written 甯戚) and commented on by Baili Xi 百里奚, who both lived during the seventh century BCE. Ning Qi himself is said to have written the book Ningzi 甯子 "Master Ning", of which only fragments survive. During the Han period 漢 (206 BCE-220 CE), a certain Master Xue 薛公 from Hexi 河西 acquired the text. The Niujing was concerned with the art of xiangjing 相牛 "[prognostication by] inspecting cows". That such a skill existed, is also proved in the chapter "The Soothsayers" (Rizhe liezhuan 日者列傳) in the universal history Shiji 史記, where there is talk of a master Chu 褚氏 from Xingyang 滎陽 who practiced this art.
It can be assumed that texts on the art of xiang niu started being written during the Han period, and that for "marketing" purposes the names of Ning Qi and Baili Xi were used, who were known as cattle breeders in antiquity. This method was also used in the field of fish farming (the invention of which was attributed to Tao Zhu Gong 陶朱公, see Yangyujing 養魚經) and sheep raising (allegedly an invention by Bu Shi 卜式, see the book Yangyangfa 養羊法). Yet the imperial bibliography Jingji zhi 經籍志 in the official dynastic history Suishu 隋書 says that the author Ning Qi was a high official at the court of the Marquis of Qi 齊侯 during the Liang period 梁 (502-557). His Xiangniujing 相牛經 was 2-juan-long, but already lost during the Tang period 唐 (618-907). It is not quoted in the famous agricultural treatise Qimin yaoshu 齊民要術 from the sixth century, which proves that it was even lost much earlier. The Qing-period 清 (1644-1911) master Huang Xiugu 黄繡穀, author of Xiangniu xinjing yaolan 相牛心鏡要覽, assumes that the book was lost during the Jin period 晉 (265-420). Yet the chapter on breeding of domestic animals (cattle, horses, donkeys) in the Qimin yaoshu is identical to the passages of Ning Qi's Xiangniushu included in the series Shuofu 說郛 which disproves Huang's assumption.
The same bibliography also lists two other books with the same title, one written by Gaotang Long 高堂隆 (d. 237), and one by Wang Liang 王良, both with a length of 2 juan. The latter lived during the Western Zhou period 西周 (11th cent.-770 BCE) and was a coach master (mache fu 馬車夫) of Zhao Xiangzi 趙襄子. Wang Liang's book was already lost during the Tang period. Interestingly enough, sources about Wang Liang say that he was good at divinatory inspection of horses (xiangma 相馬, see Xiangmajing 相馬經), and say nothing about cows. The errors lies probably in the Jingji zhi. The book by Gaotang Long was, according to the commentary on the Shishuo xinyu, written during the Wei period 曹魏 (220-265) and was presented by Gaotang to Emperor Xuan 晉宣帝 (i.e. the regent Sima Yi 司馬懿).
The book came later into the possession of Wang Kai 王愷. According to this statement, it was a compilation of Gaotang Long's ancestor Gaotang Sheng 高堂生, who lived during the very early Han period. Gaotang Long's biography in the history book Sanguozhi 三國志 calls him a Confucian scholar - yet as a such he might barely have mastered any skills of divination, which belonged rather to the field of Daoist masters. At least, it is known that in the commandery where he lived, there was a cowherd with excellent talents whom Gao recommenced to Emperor Ming 魏明帝 (r. 226－239 CE). This biography resembles that of Bu Shi, but Gaotang Long himself did not have to do with cattle.
The question who the real author of the transmitted text corpus of the Xiangniujing was, cannot be answered. It might have been an anonymous person who compiled this text during the Jin or Liang period and brought it into circulation under the names of Ning Qi or Gaotang Long. Except the collection Shuofu 說郛, the series Baichuan xuehai 百川學海, Wuchao xiaoshuo 五朝小說 and Shuibian linxia 水邊林下 include the transmitted text, too.